diff options
| author | Darryl L. Pierce <mcpierce@apache.org> | 2013-09-11 21:13:06 +0000 |
|---|---|---|
| committer | Darryl L. Pierce <mcpierce@apache.org> | 2013-09-11 21:13:06 +0000 |
| commit | 22b2a9a49eff4901fae0ef4987559aec59b4f683 (patch) | |
| tree | 4d6e9f8340f5b9fab1cba746170b35c0b1e63a59 /qpid/cpp/bindings | |
| parent | 4fe2d26d1ab8343a8bde3707fd2676fd6f6f5c98 (diff) | |
| download | qpid-python-22b2a9a49eff4901fae0ef4987559aec59b4f683.tar.gz | |
QPID-5133: Add option to the spout examples to enable durable messages
Each of the examples (C++, Ruby, Perl, Python) now have a command line
option to set the durable flag on messages sent. This allows for
experimenting with message persistence.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1522042 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/bindings')
| -rwxr-xr-x | qpid/cpp/bindings/qpid/examples/perl/spout.pl | 5 | ||||
| -rw-r--r-- | qpid/cpp/bindings/qpid/ruby/examples/spout.rb | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/qpid/cpp/bindings/qpid/examples/perl/spout.pl b/qpid/cpp/bindings/qpid/examples/perl/spout.pl index 74e589b617..7468a25a3a 100755 --- a/qpid/cpp/bindings/qpid/examples/perl/spout.pl +++ b/qpid/cpp/bindings/qpid/examples/perl/spout.pl @@ -28,6 +28,7 @@ use Time::Local; my $url = "127.0.0.1"; my $timeout = 0; my $count = 1; +my $durable = 0; my $id = ""; my $replyto = ""; my @properties; @@ -41,6 +42,7 @@ my $result = GetOptions( "broker|b=s" => \$url, "timeout|t=i" => \$timeout, "count|c=i" => \$count, + "durable|d" => \$durable, "id|i=s" => \$id, "replyto=s" => \$replyto, "property|p=s@" => \@properties, @@ -96,6 +98,9 @@ eval { $message->set_content_type("text/plain"); } + # set durable flag + $message->set_durable($durable); + # if a reply-to address was supplied, then create a receiver from the # session and wait for a response to be sent my $receiver; diff --git a/qpid/cpp/bindings/qpid/ruby/examples/spout.rb b/qpid/cpp/bindings/qpid/ruby/examples/spout.rb index ebcf08b7a5..6a0751e682 100644 --- a/qpid/cpp/bindings/qpid/ruby/examples/spout.rb +++ b/qpid/cpp/bindings/qpid/ruby/examples/spout.rb @@ -26,6 +26,7 @@ options = { :broker => "127.0.0.1", :address => "", :timeout => 0, + :durable => false, :count => 1, :properties => {}, :content => nil, @@ -51,6 +52,11 @@ opts = OptionParser.new do |opts| options[:timeout] = Qpid::Messaging::Duration.new timeout * 1000 end + opts.on("-d", "--durable", + "make the message durable (def. #{options[:durable]})") do + options[:durable] = true + end + opts.on("-c", "--count VALUE", Integer, "stop after count messages have been sent, zero disables") do |count| options[:count] = count @@ -135,6 +141,7 @@ options[:properties].each_key {|key| message[key] = options[:properties][key]} elsif options[:content] message.content = options[:content] end + message.durable = options[:durable] message.content = options[:content] unless options[:content].nil? message.properties["spout-id"] = "#{count}" message.reply_to = options[:replyto] unless options[:replyto].nil? || options[:replyto].empty? |
