Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 652226 Details for
Bug 878940
spout/drain examples fixes and improvements
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Adds fixes to spout.pl and drain.pl
0001-BZ878940-Fixes-and-improvements-to-spout.pl-and-drai.patch (text/plain), 5.72 KB, created by
Darryl L. Pierce
on 2012-11-26 19:32:54 UTC
(
hide
)
Description:
Adds fixes to spout.pl and drain.pl
Filename:
MIME Type:
Creator:
Darryl L. Pierce
Created:
2012-11-26 19:32:54 UTC
Size:
5.72 KB
patch
obsolete
>From 2bbac08f422c166f751deb49024a7953593f9a3d Mon Sep 17 00:00:00 2001 >From: "Darryl L. Pierce" <dpierce@redhat.com> >Date: Mon, 26 Nov 2012 13:24:32 -0500 >Subject: [PATCH] BZ878940 - Fixes and improvements to spout.pl and drain.pl > >Initial changes from Petr Matousek with additions from Darryl Pierce for >show usage information. >--- > qpid/cpp/bindings/qpid/examples/perl/drain.pl | 40 ++++++++++++++++++++----- > qpid/cpp/bindings/qpid/examples/perl/spout.pl | 43 ++++++++++++++++++++------- > 2 files changed, 64 insertions(+), 19 deletions(-) > >diff --git a/qpid/cpp/bindings/qpid/examples/perl/drain.pl b/qpid/cpp/bindings/qpid/examples/perl/drain.pl >index 60ac0c5..78dd8b9 100644 >--- a/qpid/cpp/bindings/qpid/examples/perl/drain.pl >+++ b/qpid/cpp/bindings/qpid/examples/perl/drain.pl >@@ -22,13 +22,15 @@ use warnings; > > use cqpid_perl; > use Getopt::Long; >+use Pod::Usage; > > my $url = "127.0.0.1"; >-my $timeout = 60; >+my $timeout = 0; > my $forever = 0; >-my $count = 1; >+my $count = 0; > my $connectionOptions = ""; > my $address = "amq.direct"; >+my $help; > > my $result = GetOptions( > "broker|b=s" => \ $url, >@@ -36,11 +38,10 @@ my $result = GetOptions( > "forever|f" => \ $forever, > "connection-options=s" => \ $connectionOptions, > "count|c=i" => \ $count, >-); >+ "help|h" => \ $help >+ ) || pod2usage(-verbose => 0); > >-if (! $result) { >- print "Usage: perl drain.pl [OPTIONS]\n"; >-} >+pod2usage(-verbose => 1) if $help; > > if ($#ARGV ge 0) { > $address = $ARGV[0] >@@ -50,6 +51,10 @@ sub getTimeout { > return ($forever) ? $cqpid_perl::Duration::FOREVER : new cqpid_perl::Duration($timeout*1000); > } > >+sub printProperties { >+ my $h = shift(); >+ return qq[{${\(join', ',map"'$_': '$h->{$_}'",keys%$h)}}] >+} > > my $connection = new cqpid_perl::Connection($url, $connectionOptions); > >@@ -63,7 +68,8 @@ eval { > my $i = 0; > > while($receiver->fetch($message, $timeout)) { >- print "Message(properties=" . $message->getProperties() . ",content='"; >+ my $redelivered = ($message->getRedelivered) ? "redelivered=True, " : ""; >+ print "Message(" . $redelivered . "properties=" . printProperties($message->getProperties()) . ", content='"; > if ($message->getContentType() eq "amqp/map") { > my $content = cqpid_perl::decodeMap($message); > map{ print "\n$_ => $content->{$_}"; } keys %{$content}; >@@ -72,7 +78,7 @@ eval { > print $message->getContent(); > } > print "')\n"; >- >+ > my $replyto = $message->getReplyTo(); > if ($replyto->getName()) { > print "Replying to " . $message->getReplyTo()->str() . "...\n"; >@@ -96,3 +102,21 @@ if ($@) { > die $@; > } > >+__END__ >+ >+=head1 NAME >+ >+drain - Drains messages from the specified address >+ >+=head1 SYNOPSIS >+ >+ Options: >+ -h, --help show this message >+ -b VALUE, --broker VALUE url of broker to connect to >+ -t VALUE, --timeout VALUE timeout in seconds to wait before exiting >+ -f, --forever ignore timeout and wait forever >+ --connection-options VALUE connection options string in the form {name1:value1, name2:value2} >+ -c VALUE, --count VALUE number of messages to read before exiting >+ >+=cut >+ >diff --git a/qpid/cpp/bindings/qpid/examples/perl/spout.pl b/qpid/cpp/bindings/qpid/examples/perl/spout.pl >index 7365e73..6839bda 100644 >--- a/qpid/cpp/bindings/qpid/examples/perl/spout.pl >+++ b/qpid/cpp/bindings/qpid/examples/perl/spout.pl >@@ -22,6 +22,7 @@ use warnings; > > use cqpid_perl; > use Getopt::Long; >+use Pod::Usage; > use Time::Local; > > my $url = "127.0.0.1"; >@@ -34,6 +35,7 @@ my @entries; > my $content = ""; > my $connectionOptions = ""; > my $address = "amq.direct"; >+my $help; > > my $result = GetOptions( > "broker|b=s" => \ $url, >@@ -44,20 +46,16 @@ my $result = GetOptions( > "property|p=s@" => \ @properties, > "map|m=s@" => \ @entries, > "content=s" => \ $content, >- "connection-options=s" => \ $connectionOptions, >-); >- >- >-if (! $result) { >- print "Usage: perl drain.pl [OPTIONS]\n"; >-} >+ "connection-options=s" => \ $connectionOptions, >+ "help|h|?" => \$help >+ ) || pod2usage(-verbose => 0); > >+pod2usage(-verbose => 1) if $help; > > if ($#ARGV ge 0) { > $address = $ARGV[0] > } > >- > sub setEntries { > my ($content) = @_; > >@@ -73,7 +71,7 @@ sub setProperties { > > foreach (@properties) { > my ($name, $value) = split("=", $_); >- $message->getProperties()->{$name} = $value; >+ $message->setProperty($name, $value); > } > } > >@@ -108,9 +106,9 @@ eval { > my $s = "$s[3]$s[4]$s[5]"; > my $n = $s; > >- for (my $i = 0; >+ for (my $i = 0; > ($i < $count || $count == 0) and >- ($timeout == 0 || abs($n - $s) < $timeout); >+ ($timeout == 0 || abs($n - $s) < $timeout); > $i++) { > > $sender->send($message); >@@ -134,3 +132,26 @@ if ($@) { > } > > >+__END__ >+ >+=head1 NAME >+ >+spout - Send messages to the specified address >+ >+=head1 SYNOPSIS >+ >+ Usage: spout [OPTIONS] ADDRESS >+ >+ Options: >+ -h, --help show this message >+ -b VALUE, --broker VALUE url of broker to connect to >+ -t VALUE, --timeout VALUE exit after the specified time >+ -c VALUE, --count VALUE stop after count messageshave been sent, zero disables >+ -i VALUE, --id VALUE use the supplied id instead of generating one >+ --reply-to VALUE specify reply-to value >+ -P VALUE, --property VALUE specify message property >+ -M VALUE, --map VALUE specify entry for map content >+ --content VALUE specify textual content >+ --connection-options VALUE connection options string in the form {name1:value1, name2:value2} >+ >+=cut >-- >1.7.11.7 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 878940
:
649277
|
649278
| 652226