You can do something like this.... my $stomp = Net::Stomp->new( { hostname => "192.168.42.30", port => '61613' } ); $stomp->connect(); $stomp->subscribe( { destination => '/queue/testq', 'ack' => 'client', 'activemq.prefetchSize' => 1, } ); $stomp->subscribe( { destination => '/queue/testq2', 'ack' => 'client', 'activemq.prefetchSize' => 1, } );
while (1) { my $frame = $stomp->receive_frame; # if $frame->headers->{'destination'} eq '/queue/testq' # handle testq message # if $frame->headers->{'destination') eq '/queue/testq2' # handle testq2 message } On Mon, Sep 28, 2009 at 6:02 AM, nmittal <nmit...@rblt.com> wrote: > > Hi All, > the following code snippet, leads me to believe that we can subscribe to > only one destination at a time... > > my $stomp = Net::Stomp->new( { hostname => "192.168.42.30", port => '61613' > } ); > $stomp->connect(); > $stomp->subscribe( > { destination => '/queue/testq', > 'ack' => 'client', > 'activemq.prefetchSize' => 1, > } > ); > > while (1) { > my $frame = $stomp->receive_frame; > } > > How can I subscribe to multiple destinations? do I have to do something > like > this... > > my $stomp = Net::Stomp->new( { hostname => "192.168.42.30", port => '61613' > } ); > $stomp->connect(); > $stomp->subscribe( > { destination => '/queue/testq', > 'ack' => 'client', > 'activemq.prefetchSize' => 1, > } > ); > my $stomp1 = Net::Stomp->new( { hostname => "192.168.42.30", port => > '61613' > } ); > $stomp1->connect(); > $stomp1->subscribe( > { destination => '/queue/testq2', > 'ack' => 'client', > 'activemq.prefetchSize' => 1, > } > ); > > while (1) { > my $frame = $stomp->receive_frame || $stomp1->receive_frame; > } > > or is there a more elegant way of doing this. > > thanks for your help > > -- > View this message in context: > http://www.nabble.com/PERL-STOMP%3A-Subscribe-to-multiple-destinations-tp25645168p25645168.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > >