activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmittal <nmit...@rblt.com>
Subject Re: PERL/STOMP: Subscribe to multiple destinations
Date Thu, 01 Oct 2009 18:17:11 GMT

Perfect this is what I was looking for. Thanks for your time.



Roger Hoover wrote:
> 
> 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 <nmittal@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.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/PERL-STOMP%3A-Subscribe-to-multiple-destinations-tp25645168p25704079.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message