activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dejan Bosanac <de...@nighttale.net>
Subject Re: php ack problem
Date Thu, 05 Jan 2012 13:03:56 GMT
Found a bug related to this https://issues.apache.org/jira/browse/AMQ-3653

It's fixed on the trunk now. On the current version of broker, just avoid
having content-length header in your acks.

Regards
-- 
Dejan Bosanac - http://twitter.com/dejanb
-----------------
The experts in open source integration and messaging - http://fusesource.com
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Wed, Jan 4, 2012 at 10:25 PM, Christopher Wood <
christopher_wood@pobox.com> wrote:

> I have a problem with ActiveMQ not removing messages from a queue when the
> ack is received from PHP. Do you list denizens possibly know what's going
> on?
>
> As background, it appears that Net::STOMP::Client adds a content-length
> header to a message, whereas PHP's Stomp doesn't. When Net::STOMP::Client
> sends an ack it only sends the message-id, whereas PHP's Stomp sends back
> all the message headers. When the message headers include a content-length,
> ActiveMQ doesn't remove the message from its queue.
>
>
> Below are some sample message fragments as copied from my tcpdumps. I've
> obfuscated the hostname.
>
> (By "works" below I mean that the ack does cause ActiveMQ to remove the
> message from the queue. By "doesn't work" below I mean that the ack doesn't
> cause ActiveMQ to remove the message from the queue.)
>
>
> For instance, if these are the message headers (enqueued by
> Net::STOMP::Client):
>
> MESSAGE
> message-id:ID:hostname.com-56519-1325672705030-4:3316:-1:1:1
> destination:/queue/ldapcwood
> timestamp:1325697918445
> expires:0
> content-length:8511
> priority:4
>
>
> Then the php ack doesn't work:
>
> ACK
> redelivered:true
> message-id:ID:hostname.com-56519-1325672705030-4:3316:-1:1:1
> destination:/queue/ldapcwood
> timestamp:1325697918445
> expires:0
> content-length:8511
> priority:4
>
>
>
> If these are the message headers (enqueued by php):
>
> MESSAGE
> message-id:ID:hostname.com-56519-1325672705030-4:3044:-1:1:1
> destination:/queue/ldapin.cwood
> timestamp:1325695920628
> expires:0
> priority:4
>
> Then the php ack works:
>
> ACK
> message-id:ID:hostname.com-56519-1325672705030-4:3044:-1:1:1
> destination:/queue/ldapin.cwood
> timestamp:1325695920628
> expires:0
> priority:4
>
>
>
>
> This is the only sort of ack that Net::STOMP::Client produces for any set
> of message headers, and ActiveMQ always removes the message from the queue:
>
> ACK
> message-id:ID:hostname.com-56519-1325672705030-4:3232:-1:1:1
>
>
>
>
> My ActiveMQ host's versions are:
>
> Platform: Debian Stable (Squeeze)
> ActiveMQ: 5.5.1
> Java: OpenJDK 6b18
>
> My client host's versions are:
>
> Platform: Debian Stable (Squeeze)
>
> Perl: 5.10.1
> Net::STOMP::Client: 1.3
>
> PHP: 5.3.3 ("with Suhosin-Patch")
> PECL Stomp: 1.0.3
>
> (Although I saw the same behaviour with FuseSource's Stomp client, version
> 1.0.0.)
>
>
>
>
>
> To get the payload, I did this:
>
> echo -n bar >/tmp/bar
>
> Here are the perl/php fragments I use to reproduce this. I've obfuscated
> the hostnames, usernames, and passwords.
>
> This enqueues a message:
>
> ----------------------------------------------------------------------
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> use File::Slurp;
> use Net::STOMP::Client;
>
> my $queue = '/queue/ldapcwood';
>
> my $stomp = Net::STOMP::Client->new(
>    uri     => 'stomp://hostname.com:61612',
>    timeout => { connect => 5, connected => 5, receive => 5, send => 5
}
> );
>
> my $connect = $stomp->connect( login => 'cwood', passcode => 'pass' );
>
> my $payload = read_file('/tmp/bar');
>
> $stomp->send( destination => $queue, body => $payload );
>
> $stomp->disconnect();
> ----------------------------------------------------------------------
>
>
> This enqueues a message:
>
> ----------------------------------------------------------------------
> <?php
>
> $queue  = '/queue/ldapcwood';
>
> $msg = file_get_contents('/tmp/bar');
>
> try {
>    $stomp = new Stomp('tcp://hostname.com:61612', 'cwood', 'pass');
> } catch(StompException $e) {
>    die('Connection failed: ' . $e->getMessage());
> }
>
> $stomp->send($queue, $msg);
>
> unset($stomp);
>
> ?>
> ----------------------------------------------------------------------
>
>
> This dequeues a message:
>
> ----------------------------------------------------------------------
> <?php
>
> $queue  = '/queue/ldapcwood';
>
> try {
>    $stomp = new Stomp('tcp://hostname.com:61612', 'cwood', 'pass');
> } catch(StompException $e) {
>    die('Connection failed: ' . $e->getMessage());
> }
>
> $stomp->subscribe($queue, array('ack' => 'client'));
>
> $frame = $stomp->readFrame();
> var_dump($frame);
>
> if ($stomp->ack($frame)) {
>  #nothing
> } else {
>  var_dump($stomp->error());
> }
>
> unset($stomp);
>
> ?>
> ----------------------------------------------------------------------
>

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