You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2013/02/18 23:08:31 UTC

svn commit: r1447519 - in /qpid/trunk/qpid/cpp/bindings/qpid/examples/perl: client.pl drain.pl hello_world.pl hello_xml.pl map_receiver.pl map_sender.pl server.pl spout.pl

Author: mcpierce
Date: Mon Feb 18 22:08:31 2013
New Revision: 1447519

URL: http://svn.apache.org/r1447519
Log:
QPID-4587: Improve the quality of the Perl examples.

Added more detailed comments to the code, and reformatted it.

Modified:
    qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/client.pl
    qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/drain.pl
    qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl
    qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl
    qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl
    qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl
    qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/server.pl
    qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/spout.pl

Modified: qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/client.pl
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/client.pl?rev=1447519&r1=1447518&r2=1447519&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/client.pl (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/client.pl Mon Feb 18 22:08:31 2013
@@ -22,45 +22,57 @@ use warnings;
 
 use qpid;
 
-my $url = ( @ARGV == 1 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
-my $connectionOptions =  ( @ARGV > 1 ) ? $ARGV[1] : "";
+my $url               = ( @ARGV == 1 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
+my $connectionOptions = ( @ARGV > 1 )  ? $ARGV[1] : "";
 
-
-my $connection = new qpid::messaging::Connection($url, $connectionOptions);
+# creates a new connection instance
+my $connection = new qpid::messaging::Connection( $url, $connectionOptions );
 
 eval {
-$connection->open();
-my $session = $connection->create_session();
+    # open the connection and create a session for interacting with it
+    $connection->open();
 
-my $sender = $session->create_sender("service_queue");
+    my $session = $connection->create_session();
+    my $sender  = $session->create_sender("service_queue");
 
-#create temp queue & receiver...
-my $responseQueue = new qpid::messaging::Address("#response-queue; {create:always, delete:always}");
-my $receiver = $session->create_receiver($responseQueue);
-
-#Now send some messages...
-
-my @s = (
-      "Twas brillig, and the slithy toves",
-      "Did gire and gymble in the wabe.",
-      "All mimsy were the borogroves,",
-      "And the mome raths outgrabe."
-     );
-
-my $request = new qpid::messaging::Message();
-$request->set_reply_to($responseQueue);
-for (my $i=0; $i<4; $i++) {
-    $request->set_content($s[$i]);
-    $sender->send($request);
-    my $response = $receiver->fetch();
-    print $request->get_content() . " -> " . $response->get_content() . "\n";
-}
+    # create an address and receiver for incoming messages
+    # the queue will be created always, and will be deleted
+    # when the receive disconnects
+    my $responseQueue = new qpid::messaging::Address(
+        "#response-queue; {create:always, delete:always}");
+    my $receiver = $session->create_receiver($responseQueue);
+
+    # Now send some messages...
+
+    my @s = (
+        "Twas brillig, and the slithy toves",
+        "Did gire and gymble in the wabe.",
+        "All mimsy were the borogroves,",
+        "And the mome raths outgrabe."
+    );
+
+    # create the message object, and set a reply-to address
+    # so that the server knows where to send responses
+    # the message object will be reused to send each line
+    my $request = new qpid::messaging::Message();
+    $request->set_reply_to($responseQueue);
+    for ( my $i = 0 ; $i < 4 ; $i++ ) {
+        $request->set_content( $s[$i] );
+        $sender->send($request);
+
+        # wait for the response to the last line sent
+        # the message will be taken directly from the
+        # broker's queue rather than waiting for it
+        # to be queued locally
+        my $response = $receiver->fetch();
+        print $request->get_content() . " -> "
+          . $response->get_content() . "\n";
+    }
 
-$connection->close();
+    # close the connection
+    $connection->close();
 };
 
 if ($@) {
     die $@;
 }
-
-

Modified: qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/drain.pl
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/drain.pl?rev=1447519&r1=1447518&r2=1447519&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/drain.pl (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/drain.pl Mon Feb 18 22:08:31 2013
@@ -24,90 +24,114 @@ use qpid;
 use Getopt::Long;
 use Pod::Usage;
 
-my $url = "127.0.0.1";
-my $timeout = 0;
-my $forever = 0;
-my $count   = 0;
+my $url               = "127.0.0.1";
+my $timeout           = 0;
+my $forever           = 0;
+my $count             = 0;
 my $connectionOptions = "";
-my $address = "amq.direct";
+my $address           = "amq.direct";
 my $help;
 
 my $result = GetOptions(
-    "broker|b=s"           => \ $url,
-    "timeout|t=i"          => \ $timeout,
-    "forever|f"            => \ $forever,
-    "connection-options=s" => \ $connectionOptions,
-    "count|c=i"            => \ $count,
-    "help|h"               => \ $help
-    ) || pod2usage(-verbose => 0);
+    "broker|b=s"           => \$url,
+    "timeout|t=i"          => \$timeout,
+    "forever|f"            => \$forever,
+    "connection-options=s" => \$connectionOptions,
+    "count|c=i"            => \$count,
+    "help|h"               => \$help
+) || pod2usage( -verbose => 0 );
 
-pod2usage(-verbose => 1) if $help;
+pod2usage( -verbose => 1 ) if $help;
 
-if ($#ARGV ge 0) {
-    $address = $ARGV[0]
+if ( $#ARGV ge 0 ) {
+    $address = $ARGV[0];
 }
 
 sub getTimeout {
-   return ($forever) ? qpid::messaging::Duration::FOREVER : new qpid::messaging::Duration($timeout*1000);
+
+    # returns either the named duration FOREVER if the
+    # forever cmdline argument was used, otherwise creates
+    # a new Duration of the specified length
+    return ($forever)
+      ? qpid::messaging::Duration::FOREVER
+      : new qpid::messaging::Duration( $timeout * 1000 );
 }
 
 sub printProperties {
-  my $h = shift();
-  return qq[{${\(join', ',map"'$_': '$h->{$_}'",keys%$h)}}]
+    my $h = shift();
+    return qq[{${\(join', ',map"'$_': '$h->{$_}'",keys%$h)}}];
 }
 
-my $connection = new qpid::messaging::Connection($url, $connectionOptions);
+# create a connection object
+my $connection = new qpid::messaging::Connection( $url, $connectionOptions );
 
 eval {
+    # open the connection, then create a session and receiver
     $connection->open();
     my $session  = $connection->create_session();
     my $receiver = $session->create_receiver($address);
     my $timeout  = getTimeout();
-    my $message = new qpid::messaging::Message();
-    my $i = 0;
+    my $message  = new qpid::messaging::Message();
+    my $i        = 0;
 
-    for (;;) {
-        eval {
-            $message = $receiver->fetch($timeout);
-        };
+    for ( ; ; ) {
+        eval { $message = $receiver->fetch($timeout); };
 
         if ($@) {
             last;
         }
 
-        my $redelivered = ($message->get_redelivered) ? "redelivered=True, " : "";
-        print "Message(" . $redelivered . "properties=" . printProperties($message->get_properties()) . ", content='";        
-        if ($message->get_content_type() eq "amqp/map") {
+        # check if the message was on that was redelivered
+        my $redelivered =
+          ( $message->get_redelivered ) ? "redelivered=True, " : "";
+        print "Message("
+          . $redelivered
+          . "properties="
+          . printProperties( $message->get_properties() )
+          . ", content='";
+
+        # if the message content was a map, then we will print
+        # it out as a series of name => value pairs
+        if ( $message->get_content_type() eq "amqp/map" ) {
             my $content = $message->get_content();
-            map{ print "\n$_ => $content->{$_}"; } keys %{$content};
+            map { print "\n$_ => $content->{$_}"; } keys %{$content};
         }
         else {
+            # it's not a map, so just print the content as a string
             print $message->get_content();
         }
         print "')\n";
 
+        # if the message had a reply-to address, then we'll send a
+        # response back letting the send know the message was processed
         my $replyto = $message->get_reply_to();
-        if ($replyto->get_name()) {
+        if ( $replyto->get_name() ) {
             print "Replying to " . $message->get_reply_to()->str() . "...\n";
+
+            # create a temporary sender for the specified queue
             my $sender = $session->create_sender($replyto);
-            my $response = new qpid::messaging::Message("received by the server.");
+            my $response =
+              new qpid::messaging::Message("received by the server.");
             $sender->send($response);
         }
+
+        # acknowledge all messages received on this queue so far
         $session->acknowledge();
 
-        if ($count and (++$i ==$count)) {
+        if ( $count and ( ++$i == $count ) ) {
             last;
         }
     }
 
+    # close everything to clean up
     $receiver->close();
     $session->close();
     $connection->close();
 };
 
 if ($@) {
-  $connection->close();
-  die $@;
+    $connection->close();
+    die $@;
 }
 
 __END__

Modified: qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl?rev=1447519&r1=1447518&r2=1447519&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl Mon Feb 18 22:08:31 2013
@@ -27,9 +27,11 @@ my $broker            = ( @ARGV > 0 ) ? 
 my $address           = ( @ARGV > 1 ) ? $ARGV[0] : "amq.topic";
 my $connectionOptions = ( @ARGV > 2 ) ? $ARGV[1] : "";
 
-my $connection = new qpid::messaging::Connection($broker, $connectionOptions);
+# create a connection
+my $connection = new qpid::messaging::Connection( $broker, $connectionOptions );
 
 eval {
+    # open the connection and create a session, and both a sender a receive
     $connection->open();
 
     my $session = $connection->create_session();
@@ -37,13 +39,17 @@ eval {
     my $receiver = $session->create_receiver($address);
     my $sender   = $session->create_sender($address);
 
-    $sender->send(new qpid::messaging::Message("Hello world!"));
+    # send a simple message
+    $sender->send( new qpid::messaging::Message("Hello world!") );
 
+    # receive the message, fetching it directly from the broker
     my $message = $receiver->fetch(qpid::messaging::Duration::SECOND);
 
+    # output the message content, then acknowledge it
     print $message->get_content() . "\n";
     $session->acknowledge();
 
+    # close the connection
     $connection->close();
 };
 

Modified: qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl?rev=1447519&r1=1447518&r2=1447519&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl Mon Feb 18 22:08:31 2013
@@ -43,15 +43,17 @@ x-bindings: [{ exchange: xml-exchange, k
 }}
 END
 
-
-my $connection = new qpid::messaging::Connection($broker, $connectionOptions);
+# create a connection object
+my $connection = new qpid::messaging::Connection( $broker, $connectionOptions );
 
 eval {
+    # open the connection, then create from it a session
+    # from the session, create a receiver to handle incoming messages
     $connection->open();
     my $session = $connection->create_session();
-
     my $receiver = $session->create_receiver($address);
 
+    # create a message and set its contentn
     my $message = new qpid::messaging::Message();
 
     my $content = <<END;
@@ -64,12 +66,17 @@ eval {
 END
 
     $message->set_content($content);
+
+    # create a sender for the xml-exchange/weater topic
+    # then send the message
     my $sender = $session->create_sender('xml-exchange/weather');
     $sender->send($message);
 
+    # wait for the response and then output it to the screen
     my $response = $receiver->fetch();
     print $response->get_content() . "\n";
 
+    # close the connection
     $connection->close();
 };
 

Modified: qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl?rev=1447519&r1=1447518&r2=1447519&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl Mon Feb 18 22:08:31 2013
@@ -23,22 +23,31 @@ use Data::Dumper;
 
 use qpid;
 
-my $url               = ( @ARGV > 0 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
-my $address           = ( @ARGV > 1 ) ? $ARGV[0] : "message_queue; {create: always}";
+my $url     = ( @ARGV > 0 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
+my $address = ( @ARGV > 1 ) ? $ARGV[0] : "message_queue; {create: always}";
 my $connectionOptions = ( @ARGV > 2 ) ? $ARGV[1] : "";
 
-my $connection = new qpid::messaging::Connection($url, $connectionOptions);
+# create a connection object
+my $connection = new qpid::messaging::Connection( $url, $connectionOptions );
 
 eval {
+    # open the connection, then create a session from it
     $connection->open();
     my $session  = $connection->create_session();
+
+    # create a receiver for the session, subscribed the the specified queue
     my $receiver = $session->create_receiver($address);
+    # wait for a message to appear in the queue
     my $message  = $receiver->fetch();
-    my $content = $message->get_content();
 
+    # display the content of the message
+    my $content  = $message->get_content();
     print Dumper($content);
 
+    # acknowledge the message, removing it from the queue
     $session->acknowledge();
+
+    # close everything, cleaning up
     $receiver->close();
     $connection->close();
 };

Modified: qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl?rev=1447519&r1=1447518&r2=1447519&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl Mon Feb 18 22:08:31 2013
@@ -23,27 +23,37 @@ use Data::Dumper;
 
 use qpid;
 
-my $url               = ( @ARGV > 0 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
-my $address           = ( @ARGV > 1 ) ? $ARGV[1] : "message_queue; {create: always}";
+my $url     = ( @ARGV > 0 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
+my $address = ( @ARGV > 1 ) ? $ARGV[1] : "message_queue; {create: always}";
 my $connectionOptions = ( @ARGV > 2 ) ? $ARGV[2] : "";
 
-my $connection = new qpid::messaging::Connection($url, $connectionOptions);
+# create a new connection object
+my $connection = new qpid::messaging::Connection( $url, $connectionOptions );
 
 eval {
-    $connection->open();
 
+    # open the connection and create a session
+    $connection->open();
     my $session = $connection->create_session();
+
+    # create a sender and connect it to the supplied address string
     my $sender  = $session->create_sender($address);
 
+    # create a message and set the content to be a map of values
     my $message = new qpid::messaging::Message();
-    my $content = { id   => 987654321,
-                    name => "Widget",
-                    percent => sprintf("%.2f", 0.99),
-                    colours => [ qw (red green white) ],
-                   };
+    my $content = {
+        id      => 987654321,
+        name    => "Widget",
+        percent => sprintf( "%.2f", 0.99 ),
+        colours => [qw (red green white)],
+    };
     $message->set_content($content);
-    $sender->send($message, 1);
 
+    # send the message
+    $sender->send( $message, 1 );
+
+    # close the connection and session
+    $session->close();
     $connection->close();
 };
 

Modified: qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/server.pl
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/server.pl?rev=1447519&r1=1447518&r2=1447519&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/server.pl (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/server.pl Mon Feb 18 22:08:31 2013
@@ -22,42 +22,62 @@ use warnings;
 
 use qpid;
 
-my $url = ( @ARGV == 1 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
-my $connectionOptions =  ( @ARGV > 1 ) ? $ARGV[1] : "";
+my $url               = ( @ARGV == 1 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
+my $connectionOptions = ( @ARGV > 1 )  ? $ARGV[1] : "";
 
-
-my $connection = new qpid::messaging::Connection($url, $connectionOptions);
+# create a connection object
+my $connection = new qpid::messaging::Connection( $url, $connectionOptions );
 
 eval {
+
+    # connect to the broker and create a session
     $connection->open();
     my $session = $connection->create_session();
 
+    # create a receiver for accepting incoming messages
     my $receiver = $session->create_receiver("service_queue; {create: always}");
 
+    # go into an infinite loop to receive messages and process them
     while (1) {
+
+        # wait for the next message to be processed
         my $request = $receiver->fetch();
-        my $address = $request->get_reply_to();
 
+
+        # get the address for sending replies
+        # if no address was supplised then we can't really respond, so
+        # only process when one is present
+        my $address = $request->get_reply_to();
         if ($address) {
+
+            # a temporary sender for sending to the response queue
             my $sender = $session->create_sender($address);
-            my $s = $request->get_content();
+            my $s      = $request->get_content();
             $s = uc($s);
+
+            # create the response message and send it
             my $response = new qpid::messaging::Message($s);
             $sender->send($response);
-            print "Processed request: " . $request->get_content() . " -> " . $response->get_content() . "\n";
+            print "Processed request: "
+              . $request->get_content() . " -> "
+              . $response->get_content() . "\n";
+
+            # acknowledge the message since it was processed
             $session->acknowledge();
         }
         else {
-            print "Error: no reply address specified for request: " . $request->get_content() . "\n";
+            print "Error: no reply address specified for request: "
+              . $request->get_content() . "\n";
             $session->reject($request);
         }
     }
 
-$connection->close();
+    # close connections to clean up
+    $session->close();
+    $connection->close();
 };
 
 if ($@) {
     die $@;
 }
 
-

Modified: qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/spout.pl
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/spout.pl?rev=1447519&r1=1447518&r2=1447519&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/spout.pl (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/examples/perl/spout.pl Mon Feb 18 22:08:31 2013
@@ -25,63 +25,65 @@ use Getopt::Long;
 use Pod::Usage;
 use Time::Local;
 
-my $url = "127.0.0.1";
+my $url     = "127.0.0.1";
 my $timeout = 0;
 my $count   = 1;
 my $id      = "";
 my $replyto = "";
 my @properties;
 my @entries;
-my $content = "";
+my $content           = "";
 my $connectionOptions = "";
-my $address = "amq.direct";
+my $address           = "amq.direct";
 my $help;
 
 my $result = GetOptions(
-    "broker|b=s"           => \ $url,
-    "timeout|t=i"          => \ $timeout,
-    "count|c=i"            => \ $count,
-    "id|i=s"               => \ $id,
-    "replyto=s"            => \ $replyto,
-    "property|p=s@"        => \ @properties,
-    "map|m=s@"             => \ @entries,
-    "content=s"            => \ $content,
-    "connection-options=s" => \ $connectionOptions,
-    "help|h"               => \ $help
-    ) || pod2usage(-verbose => 0);
+    "broker|b=s"           => \$url,
+    "timeout|t=i"          => \$timeout,
+    "count|c=i"            => \$count,
+    "id|i=s"               => \$id,
+    "replyto=s"            => \$replyto,
+    "property|p=s@"        => \@properties,
+    "map|m=s@"             => \@entries,
+    "content=s"            => \$content,
+    "connection-options=s" => \$connectionOptions,
+    "help|h"               => \$help
+) || pod2usage( -verbose => 0 );
 
-pod2usage(-verbose => 1) if $help;
+pod2usage( -verbose => 1 ) if $help;
 
-if ($#ARGV ge 0) {
-    $address = $ARGV[0]
+if ( $#ARGV ge 0 ) {
+    $address = $ARGV[0];
 }
 
 sub setEntries {
     my ($content) = @_;
 
     foreach (@entries) {
-        my ($name, $value) = split("=", $_);
+        my ( $name, $value ) = split( "=", $_ );
         $content->{$name} = $value;
     }
 }
 
-
 sub setProperties {
     my ($message) = @_;
 
     foreach (@properties) {
-        my ($name, $value) = split("=", $_);
-        $message->setProperty($name, $value);
+        my ( $name, $value ) = split( "=", $_ );
+        $message->setProperty( $name, $value );
     }
 }
 
-my $connection = new qpid::messaging::Connection($url, $connectionOptions);
+# create a connection object
+my $connection = new qpid::messaging::Connection( $url, $connectionOptions );
 
 eval {
+    # open the connection, create a session and then a sender
     $connection->open();
-    my $session  = $connection->create_session();
-    my $sender = $session->create_sender($address);
+    my $session = $connection->create_session();
+    my $sender  = $session->create_sender($address);
 
+    # create a message to be sent
     my $message = new qpid::messaging::Message();
     setProperties($message) if (@properties);
     if (@entries) {
@@ -94,44 +96,49 @@ eval {
         $message->set_content_type("text/plain");
     }
 
+    # if a reply-to address was supplied, then create a receiver from the
+    # session and wait for a response to be sent
     my $receiver;
     if ($replyto) {
         my $responseQueue = new qpid::messaging::Address($replyto);
         $receiver = $session->create_receiver($responseQueue);
-        $message->setReplyTo($responseQueue);
+        $message->set_reply_to($responseQueue);
     }
 
     my $start = localtime;
-    my @s = split(/[:\s]/, $start);
-    my $s = "$s[3]$s[4]$s[5]";
-    my $n = $s;
-
-    for (my $i = 0;
-        ($i < $count || $count == 0) and
-        ($timeout == 0 || abs($n - $s) < $timeout);
-        $i++) {
+    my @s     = split( /[:\s]/, $start );
+    my $s     = "$s[3]$s[4]$s[5]";
+    my $n     = $s;
+
+    for (
+        my $i = 0 ;
+        ( $i < $count || $count == 0 )
+          and ( $timeout == 0 || abs( $n - $s ) < $timeout ) ;
+        $i++
+      )
+    {
 
         $sender->send($message);
 
         if ($receiver) {
+            print "Waiting for a response.\n";
             my $response = $receiver->fetch();
             print "$i -> " . $response->get_content() . "\n";
         }
 
         my $now = localtime;
-        my @n = split(/[:\s]/, $now);
-        my $n = "$n[3]$n[4]$n[5]";
+        my @n   = split( /[:\s]/, $now );
+        my $n   = "$n[3]$n[4]$n[5]";
     }
     $session->sync();
     $connection->close();
 };
 
 if ($@) {
-  $connection->close();
-  die $@;
+    $connection->close();
+    die $@;
 }
 
-
 __END__
 
 =head1 NAME
@@ -148,7 +155,7 @@ spout - Send messages to the specified a
   -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
+  --replyto 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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org