activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Samplonius <>
Subject 4.1.1 and Stomp; lost unacked messages
Date Sun, 27 May 2007 04:06:21 GMT

  I noticed some strange behavior with ActiveMQ 4.1.1 and the Stomp protocol.  When I connect,
I set the ack mode to "client".  I read a message, and exit.  Since I did not ack the message,
I should expect to get the same message on next execution, and I do, as long as I do an explicit
disconnect.  If I just close the socket, I do not the get the message again.

  So, it is weird.  If I send a disconnect, the un-acked message is preserved.  But if the
socket is just closed, the un-acked message is lost.

  This is not a good interaction for my application, as it is possible that the message consumer
may die or be killed, or its  network connection may be reset, while it is processing a message.
 And if the consumer does not send an ack, or send a disconnect, I could lose a message.

  How do I get the behavior I need?

  Here is the code.  If the disconnect statement is commented back in, messages are preserved:

my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '61613' } );
$stomp->connect( { login => 'system', passcode => 'manager' } );
      {   destination             => '/queue/vp',
          'ack'                   => 'client',
          'activemq.prefetchSize' => 1

my $frame = $stomp->receive_frame;
print $frame->body, ".\n"; # do something here



View raw message