activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roger Hoover <roger.hoo...@gmail.com>
Subject Re: Problems with acknowledge mode order (STOMP)
Date Sat, 07 Feb 2009 02:58:29 GMT
Hi Dejan,

Thanks again for the quick response.  Here is a very simple Perl unit test
that illustrates the bug.  I don't do too much work with Java so if you
really don't mind translating it, I appreciate it.

Thanks,

Roger

#!/usr/bin/env perl

use strict;
use Net::Stomp;
use Data::Dumper;
use Test::More tests => 1;

my $stomp = Net::Stomp->new( { 'hostname' => 'localhost', 'port' => '61613'
} );
$stomp->connect( { 'login' => 'hello', 'passcode' => 'there' } );

#Make sure queue is empty from previous tests
while($stomp->can_read({'timeout' => 1})) {
   $stomp->receive_frame();
}

# Enqueue three test messages
$stomp->send({ 'destination' => '/queue/testOutOfOrderAck', 'body' =>
'message1' } );
$stomp->send({ 'destination' => '/queue/testOutOfOrderAck', 'body' =>
'message2' } );
$stomp->send({ 'destination' => '/queue/testOutOfOrderAck', 'body' =>
'message3' } );

# Subscribe to the queue (with prefetchSize >= 3) and receive the three test
messages
$stomp->subscribe(
  {   destination             => '/queue/testOutOfOrderAck',
      'ack'                   => 'client',
      'activemq.prefetchSize' => 10
  }
);
my $frame1 = $stomp->receive_frame();
my $frame2 = $stomp->receive_frame();
my $frame3 = $stomp->receive_frame();

#Ack messages out of order (specifically, ack message 2 after message 3)
$stomp->ack({'frame' => $frame1});
$stomp->ack({'frame' => $frame3});
$stomp->ack({'frame' => $frame2});

my $error = 0;
#Wait max of 1 second for the broker to send an error frame
if ($stomp->can_read({'timeout' => 1})) {
    my $frame = $stomp->receive_frame();
    if ($frame->{'command'} eq 'ERROR') {
        $error = 1;
        print "Received error: " . Dumper($frame);
    }
}
$stomp->disconnect;

#Assert that no error was received
ok(!$error, "Ack previous message after prior message");

On Mon, Jan 26, 2009 at 12:19 AM, Dejan Bosanac <dejan@nighttale.net> wrote:

> It would be ideal to create a test case using simple Java API
>
> http://activemq.apache.org/stomp.html#Stomp-JavaAPI
>
> and add it to the
>
>
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?view=markup
>
> If Perl is easier for you, just send it and I'll translate it to the Java
> test case.
>
> Cheers
> --
> Dejan Bosanac
>
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
>
>
> On Fri, Jan 23, 2009 at 7:24 PM, Roger Hoover <roger.hoover@gmail.com
> >wrote:
>
> > Hi Dejan,
> >
> > Thanks for the reply.  Do you need it in a particular language?  I could
> > easily create a test case in Perl for it.
> >
> > Roger
> >
> > On Fri, Jan 23, 2009 at 8:31 AM, Dejan Bosanac <dejan@nighttale.net>
> > wrote:
> >
> > > It shouldn't behave that way. Can you create a test case to simulate
> this
> > > behavior?
> > >
> > > Cheers
> > > --
> > > Dejan Bosanac
> > >
> > > Open Source Integration - http://fusesource.com/
> > > ActiveMQ in Action - http://www.manning.com/snyder/
> > > Blog - http://www.nighttale.net
> > >
> > >
> > > On Fri, Jan 23, 2009 at 10:18 AM, Roger Hoover <roger.hoover@gmail.com
> > > >wrote:
> > >
> > > > I'm experiencing the same issue, both on ActiveMQ 4.1.1 and 5.2.0.
> > > >
> > > > Two questions:
> > > > 1) It seems like broker is accepting the ACK and erroneously replying
> > > with
> > > > the ERROR message.  Is that correct?
> > > > 2) Is this a bug and an intentional design to disallow STOMP clients
> > from
> > > > handle messages concurrently?
> > > >
> > > > Any insight is appreciated.  Thanks,
> > > >
> > > > Roger
> > > >
> > > > On Mon, Oct 22, 2007 at 3:42 AM, Sebastjan Trepca <trepca@gmail.com>
> > > > wrote:
> > > >
> > > > > Hi all,
> > > > >
> > > > > I'm having problems with acknowledge order in ActiveMQ 4.1.1 using
> > > > > STOMP protocol. I'm using a queue with async mode on.
> > > > >
> > > > > I'm also using these headers:
> > > > >
> > > > > SUBSCRIBE
> > > > > activemq.dispatchAsync:'true'
> > > > > activemq.noLocal:'true',
> > > > > activemq.retroactive:'true',
> > > > > activemq.prefetchSize:1000,
> > > > > activemq.maximumPendingMessageLimit:1000,
> > > > >
> > > > > MESSAGE
> > > > > expires:0,
> > > > > persistent:'true',
> > > > > priority:0,
> > > > >
> > > > >
> > > > >
> > > > > The problem occurs when I try to acknowledge messages in different
> > > > > order then they were sent.
> > > > >
> > > > > So if producer sends messages with IDs:
> > > > > 1
> > > > > 2
> > > > > 3
> > > > >
> > > > >
> > > > > I have to acknowledge them in the same order:
> > > > > 1
> > > > > 2
> > > > > 3
> > > > >
> > > > > Or else I get this error:
> > > > >
> > > > > ERROR    org.apache.activemq.transport.stomp.ProtocolException:
> > > > > Unexpected ACK received for message-id
> > > > > [ID:localhost-47986-1193059223135-3:5:-1:1:26055]
> > > > >        at
> > > > >
> > > >
> > >
> >
> org.apache.activemq.transport.stomp.ProtocolConverter.onStompAck(ProtocolConverter.java:242)
> > > > >        at
> > > > >
> > > >
> > >
> >
> org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommad(ProtocolConverter.java:141)
> > > > >        at
> > > > >
> > > >
> > >
> >
> org.apache.activemq.transport.stomp.StompTransportFilter.onCommand(StompTransportFilter.java:71)
> > > > >        at
> > > > >
> > > >
> > >
> >
> org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
> > > > >        at
> > > > >
> > >
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:137)
> > > > >        at java.lang.Thread.run(Thread.java:619)
> > > > >
> > > > > Is this a feature or a bug? Do I need to set some extra settings?
> > > > >
> > > > > Thanks, Sebastjan
> > > > >
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message