diff options
author | Gordon Sim <gsim@apache.org> | 2009-02-26 17:43:01 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2009-02-26 17:43:01 +0000 |
commit | e6f1a9404d4544e872a40c598f86e1d442cc41db (patch) | |
tree | ffcadeacdf3e73be373f2e48bc6e03bcfeafc639 /cpp/src | |
parent | 28e687d9c6a150c25f07d2d79f90ef876cf59ec2 (diff) | |
download | qpid-python-e6f1a9404d4544e872a40c598f86e1d442cc41db.tar.gz |
Added a couple of extra options that are useful in ad-hoc testing.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@748222 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/tests/sender.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/cpp/src/tests/sender.cpp b/cpp/src/tests/sender.cpp index 48062315fe..9d9e5be99d 100644 --- a/cpp/src/tests/sender.cpp +++ b/cpp/src/tests/sender.cpp @@ -24,6 +24,7 @@ #include <qpid/client/AsyncSession.h> #include <qpid/client/Message.h> #include <qpid/client/MessageReplayTracker.h> +#include <qpid/client/QueueOptions.h> #include <qpid/Exception.h> #include "TestOptions.h" @@ -40,13 +41,17 @@ struct Args : public qpid::TestOptions string destination; string key; uint sendEos; + bool durable; + string lvqMatchValue; - Args() : key("test-queue"), sendEos(0) + Args() : key("test-queue"), sendEos(0), durable(false) { - addOptions() + addOptions() ("exchange", qpid::optValue(destination, "EXCHANGE"), "Exchange to send messages to") ("routing-key", qpid::optValue(key, "KEY"), "Routing key to add to messages") - ("send-eos", qpid::optValue(sendEos, "N"), "Send N EOS messages to mark end of input"); + ("send-eos", qpid::optValue(sendEos, "N"), "Send N EOS messages to mark end of input") + ("durable", qpid::optValue(durable, "true|false"), "Mark messages as durable.") + ("lvq-match-value", qpid::optValue(lvqMatchValue, "KEY"), "The value to set for the LVQ match key property"); } }; @@ -55,7 +60,7 @@ const string EOS("eos"); class Sender : public FailoverManager::Command { public: - Sender(const std::string& destination, const std::string& key, uint sendEos); + Sender(const std::string& destination, const std::string& key, uint sendEos, bool durable, const std::string& lvqMatchValue); void execute(AsyncSession& session, bool isRetry); private: const std::string destination; @@ -65,8 +70,17 @@ class Sender : public FailoverManager::Command uint sent; }; -Sender::Sender(const std::string& dest, const std::string& key, uint eos) : - destination(dest), sender(10), message("", key), sendEos(eos), sent(0) {} +Sender::Sender(const std::string& dest, const std::string& key, uint eos, bool durable, const std::string& lvqMatchValue) : + destination(dest), sender(10), message("", key), sendEos(eos), sent(0) +{ + if (durable){ + message.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT); + } + + if (!lvqMatchValue.empty()) { + message.getHeaders().setString(QueueOptions::strLVQMatchProperty, lvqMatchValue); + } +} void Sender::execute(AsyncSession& session, bool isRetry) { @@ -90,7 +104,7 @@ int main(int argc, char ** argv) try { opts.parse(argc, argv); FailoverManager connection(opts.con); - Sender sender(opts.destination, opts.key, opts.sendEos); + Sender sender(opts.destination, opts.key, opts.sendEos, opts.durable, opts.lvqMatchValue); connection.execute(sender); connection.close(); return 0; |