Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 2613 invoked from network); 29 Apr 2009 05:43:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Apr 2009 05:43:13 -0000 Received: (qmail 95801 invoked by uid 500); 29 Apr 2009 05:43:12 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 95710 invoked by uid 500); 29 Apr 2009 05:43:12 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 95700 invoked by uid 99); 29 Apr 2009 05:43:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2009 05:43:12 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [81.169.137.254] (HELO h57067.serverkompetenz.net) (81.169.137.254) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2009 05:43:03 +0000 Received: from h57067.serverkompetenz.net (unknown [127.0.0.1]) by h57067.serverkompetenz.net (Postfix) with ESMTP id 4CD22802B0 for ; Wed, 29 Apr 2009 05:42:42 +0000 (UTC) Received: from [192.168.178.30] (unknown [88.133.4.240]) by h57067.serverkompetenz.net (Postfix) with ESMTP for ; Wed, 29 Apr 2009 05:42:42 +0000 (UTC) Message-Id: <82589C2D-7552-46F4-8F44-8AD9A72C61A6@soa-knowledge.net> From: Andreas Gies To: users@activemq.apache.org In-Reply-To: <44cb1ba30904281515h63874256v8fdff66699ea78f0@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: Queue message order Date: Wed, 29 Apr 2009 07:42:40 +0200 References: <44cb1ba30904281515h63874256v8fdff66699ea78f0@mail.gmail.com> X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org Hi Roger, may be I missed something, but if the application doesn't need the messages to be in order, why are you testing for it ? Just wondering Andreas On Apr 29, 2009, at 12:15 AM, Roger Hoover wrote: > Hi, > > Are queued messages supposed to be delivered in order? I have a > simple > STOMP Perl script below that shows messages delivered out of order. > I've > run it against AMQ 4.1.1 and 5.2.0 in with both persistent and > non-persistent messages. Note from the message ids and timestamps > that the > newer message is delivered first. > > Is there a way to force message delivery order? I don't think > selectors > allow for ordering, right? Our application doesn't particularly > depend on > message order but this behavior is causing my unit tests to fail > every third > time they are run. :( > > This also seems problematic for STOMP clients using "client" ack mode. > Since newer messages are delivered first, ack'ing the newer message > will > implicitly ack the older message which has not even been delivered > yet. > > Any help is appreciated. Thanks, > > Roger > > $ perl out-of-order.pl > OUT OF ORDER!!! > Frame 1: $VAR1 = bless( { > 'body' => 'test2', > 'headers' => { > 'priority' => '0', > 'timestamp' => '1240956094252', > 'destination' => '/queue/ > testOutOfOrder', > 'message-id' => > 'ID:thedude.local-58168-1240956067250-3:3897:-1:1:2', > 'expires' => '0' > }, > 'command' => 'MESSAGE' > }, 'Net::Stomp::Frame' ); > Frame 2: $VAR1 = bless( { > 'body' => 'test1', > 'headers' => { > 'priority' => '0', > 'timestamp' => '1240956094247', > 'destination' => '/queue/ > testOutOfOrder', > 'message-id' => > 'ID:thedude.local-58168-1240956067250-3:3897:-1:1:1', > 'expires' => '0' > }, > 'command' => 'MESSAGE' > }, 'Net::Stomp::Frame' ); > > #!/usr/bin/env perl > > use strict; > use Net::Stomp; > use Data::Dumper; > > my $stomp = Net::Stomp->new( { 'hostname' => 'localhost', 'port' => > '61613' > } ); > $stomp->connect( { 'login' => 'hello', 'passcode' => 'there' } ); > $stomp->subscribe( > { 'destination' => '/queue/testOutOfOrder', > 'ack' => 'client', > 'activemq.prefetchSize' => 1 > } > ); > while ($stomp->can_read({'timeout' => 1})) { > my $frame = $stomp->receive_frame(); > $stomp->ack({'frame' => $frame}); > } > $stomp->disconnect(); > > while (1) { > doit(); > } > > sub doit { > my $stomp = Net::Stomp->new( { 'hostname' => 'localhost', 'port' => > '61613' } ); > $stomp->connect( { 'login' => 'hello', 'passcode' => 'there' } ); > > $stomp->send({ 'destination' => '/queue/testOutOfOrder', 'body' => > 'test1', 'persistent' => 'true'} ); > $stomp->send({ 'destination' => '/queue/testOutOfOrder', 'body' => > 'test2', 'persistent' => 'true'} ); > $stomp->disconnect(); > > my $stomp = Net::Stomp->new( { 'hostname' => 'localhost', 'port' => > '61613' } ); > $stomp->connect( { 'login' => 'hello', 'passcode' => 'there' } ); > $stomp->subscribe( > { 'destination' => '/queue/testOutOfOrder', > 'ack' => 'client', > 'activemq.prefetchSize' => 1 > } > ); > my $frame1 = $stomp->receive_frame(); > $stomp->ack({'frame' => $frame1}); > my $frame2 = $stomp->receive_frame(); > $stomp->ack({'frame' => $frame2}); > $stomp->disconnect(); > > if ($frame1->{'body'} ne 'test1') { > print "OUT OF ORDER!!!\n"; > print "Frame 1: " . Dumper($frame1); > print "Frame 2: " . Dumper($frame2); > } > }