You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by welly <we...@regentmarkets.com> on 2010/01/21 12:02:07 UTC

Net::Stomp (retroactive subscription for activemq)

All,
 I would like to use Apache Activemq + Net::Stomp. 

The module works great for durable subscription , 
everything is working fine, then I am trying to use retroactive
subscription, 
but i always cant get the previous messages. I am sure i am doing some 
mistake or misunderstand something. Would you mind to help me out ?

The codes
======

x.pl

use Net::Stomp;
my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '61613' } );
$stomp->connect( { login => 'hello', passcode => 'there' } );
while(1)
{
$stomp->send(
    {
      destination => '/topic/welly', 
      body => time(),
#       persistent => 'true'
    } 
);

sleep(1);
}
$stomp->disconnect;

------------------------------------------------------------------------------------------------------

y.pl

use Net::Stomp;
my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '61613' } );
$stomp->connect(
    {
      'login' => 'hello',
      'passcode' => 'there',
#       'client-id' => 'tango',
    } 
);
$stomp->subscribe(
    {
        'ack'                   => 'client',
        'destination' => '/topic/welly',
#         'activemq.prefetchSize' => 1,
        'activemq.retroactive' => 'true',
        'activemq.maximumPendingMessageLimit' => 10,
#         'activemq.subscriptionName' => 'tango',
    }
);
while (1) {
  my $frame = $stomp->receive_frame;
  warn $frame->body;
  $stomp->ack( { frame => $frame } ); 
}
$stomp->disconnect;
------------------------------------------------------------------------------------------------------


Thanks

Welly
-- 
View this message in context: http://old.nabble.com/Net%3A%3AStomp-%28retroactive-subscription-for-activemq%29-tp27256067p27256067.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.