You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Juan Nin <ju...@gmail.com> on 2012/11/30 00:43:48 UTC

Any workaround for Stomp not supporting prefetch size of 0?

Hi!

I got the following scenario:

A queue with thousands of messages under ActiveMQ 5.3.2, which will be
consumed from a PHP web application.
The PHP application uses the FuseSource Stomp client.

Each time the PHP application is run, it needs to consume only one message
from the queue.
The problem we're having, is related to using a prefetch size of 1, since
Stomp does not support a prefetch size of 0.

We only consume and ACK 1 message, but because of the prefetch size of 1, a
second message is pushed to the client, which upon disconnection from
ActiveMQ is set for redelivery, being pushed by ActiveMQ to the end of the
queue.

We need to consume the message in sequential order, so having these
messages been pushed back to the end of the queue breaks our app.

Is there any way of avoiding this behaviour and be able to consume messages
one by one in sequential order?
We're considering developing a Java Web Service which uses a prefetch size
of 0 via OpenWire, and invoke that Web Service from the PHP application,
but if possible would prefer to avoid that workaround.

Thanks in advance.

Juan

Re: Any workaround for Stomp not supporting prefetch size of 0?

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi,

the problem with 0 prefetch and Stomp is that there's no mechanism in
stomp to explicitly pull the message from the broker. You can only
subscriber and unsubscribe from the destination. I'm not aware of any
workaround.


Regards
--
Dejan Bosanac
----------------------
Red Hat, Inc.
FuseSource is now part of Red Hat
dbosanac@redhat.com
Twitter: @dejanb
Blog: http://sensatic.net
ActiveMQ in Action: http://www.manning.com/snyder/


On Fri, Nov 30, 2012 at 12:43 AM, Juan Nin <ju...@gmail.com> wrote:
> Hi!
>
> I got the following scenario:
>
> A queue with thousands of messages under ActiveMQ 5.3.2, which will be
> consumed from a PHP web application.
> The PHP application uses the FuseSource Stomp client.
>
> Each time the PHP application is run, it needs to consume only one message
> from the queue.
> The problem we're having, is related to using a prefetch size of 1, since
> Stomp does not support a prefetch size of 0.
>
> We only consume and ACK 1 message, but because of the prefetch size of 1, a
> second message is pushed to the client, which upon disconnection from
> ActiveMQ is set for redelivery, being pushed by ActiveMQ to the end of the
> queue.
>
> We need to consume the message in sequential order, so having these
> messages been pushed back to the end of the queue breaks our app.
>
> Is there any way of avoiding this behaviour and be able to consume messages
> one by one in sequential order?
> We're considering developing a Java Web Service which uses a prefetch size
> of 0 via OpenWire, and invoke that Web Service from the PHP application,
> but if possible would prefer to avoid that workaround.
>
> Thanks in advance.
>
> Juan