activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmittal <nmit...@rblt.com>
Subject PERL/STOMP: Subscribe to multiple destinations
Date Mon, 28 Sep 2009 13:02:38 GMT

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.


Mime
View raw message