You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Pesochinskiy, Vadim (MSCIBARRA)" <Va...@mscibarra.com> on 2006/08/08 22:11:42 UTC
Implementing prefetchSize=0
Hi!
I am trying to figure out how this can be done.
As I understand messages are forwarded by the queue to every consumer
(PrefetchSubscription). As long as number of messages dispatched does
not exceed the prefetchSize, messages are send to the client. As soon as
messages are acked more messages are dispatched to the client.
When I set prefetchSize=0 no messages are ever delivered. In this case
instead of pushing messages from the server, they will have to be
requested by the client every time receive() or receiveNoWait() is
called. Are you OK with this impelementation?
BTW, are you guys convinced that AMQ-855 is an issue that needs to be
resolved? To remind you, I need multiple consumers to implement our
prioriteis requirements. In some cases consumers maybe be idle for a
long time and as a result they hold real-time messages, which otherwise
could to be processed by other consumers.
https://issues.apache.org/activemq/browse/AMQ-855
http://www.nabble.com/forum/ViewPost.jtp?post=5583273&framed=y
--------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.
Re: Implementing prefetchSize=0
Posted by Hiram Chirino <hi...@hiramchirino.com>.
I'm not convinced that this is needed. As I commented on the previous
thread, the only reason that this is a problem is that a single thread
is creating multiple consumers. If you use a single consumer, per
thread this would not be an issue.
Regards,
Hiram
On 8/8/06, Pesochinskiy, Vadim (MSCIBARRA)
<Va...@mscibarra.com> wrote:
> Hi!
>
> I am trying to figure out how this can be done.
>
> As I understand messages are forwarded by the queue to every consumer
> (PrefetchSubscription). As long as number of messages dispatched does
> not exceed the prefetchSize, messages are send to the client. As soon as
> messages are acked more messages are dispatched to the client.
>
> When I set prefetchSize=0 no messages are ever delivered. In this case
> instead of pushing messages from the server, they will have to be
> requested by the client every time receive() or receiveNoWait() is
> called. Are you OK with this impelementation?
>
> BTW, are you guys convinced that AMQ-855 is an issue that needs to be
> resolved? To remind you, I need multiple consumers to implement our
> prioriteis requirements. In some cases consumers maybe be idle for a
> long time and as a result they hold real-time messages, which otherwise
> could to be processed by other consumers.
>
> https://issues.apache.org/activemq/browse/AMQ-855
>
> http://www.nabble.com/forum/ViewPost.jtp?post=5583273&framed=y
> --------------------------------------------------------
>
> NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.
>
--
Regards,
Hiram
Blog: http://hiramchirino.com
Re: Implementing prefetchSize=0
Posted by James Strachan <ja...@gmail.com>.
Note that to implement the JMS API - the minimum value of prefetch
possible is 1 which means deliver 1 message then wait until an
acknowledgement before delivering another. This is essential to
implement
consumer.setMessageListener()
consumer.receiveNoWait().
Neither of which are possible to implement with a prefetch of zero
which effectively means you cannot dispatch messages to the consumers
at all - they must pull them on demand.
We could implement the method consumer.receive() to block and
explicitly perform a request-response to the broker pulling a message.
With a bit more thought we might figure out a way of implementing
receive(timeout) where if a message is delivered by the broker after
the timeout we give it back to the broker.
Though i"m with Hiram on this one - I don't think a prefetch of zero
is really needed. Also note that receive() wouldn't solve your use
case since it would deliver you a message on the requested queue
anyway. What you really want is 'receive a message if you can on queue
1, then if not on queue2 then if not on queue 3' which is quite
different to a prefetch of zeron.
You'd be better creating a single consumer which consumes to all 3
queues using a wildard or composite destination or even just a single
queue. Then you might want to create your own DispatchPolicy to decide
which messages get dispatched to which consumers - or write some
reordering logic in a Broker Interceptor to make sure that any 'big
jobs' are reordered to be ahead of any 'small jobs' by waiting a small
amount of time to see if you can reorder things.
i.e. what you really want to do is just reorder messages on a queue
based on their priority. Even if we had a prefetch of zero I don't
think it'll help you much.
On 8/8/06, Pesochinskiy, Vadim (MSCIBARRA)
<Va...@mscibarra.com> wrote:
> Hi!
>
> I am trying to figure out how this can be done.
>
> As I understand messages are forwarded by the queue to every consumer
> (PrefetchSubscription). As long as number of messages dispatched does
> not exceed the prefetchSize, messages are send to the client. As soon as
> messages are acked more messages are dispatched to the client.
>
> When I set prefetchSize=0 no messages are ever delivered. In this case
> instead of pushing messages from the server, they will have to be
> requested by the client every time receive() or receiveNoWait() is
> called. Are you OK with this impelementation?
>
> BTW, are you guys convinced that AMQ-855 is an issue that needs to be
> resolved? To remind you, I need multiple consumers to implement our
> prioriteis requirements. In some cases consumers maybe be idle for a
> long time and as a result they hold real-time messages, which otherwise
> could to be processed by other consumers.
>
> https://issues.apache.org/activemq/browse/AMQ-855
>
> http://www.nabble.com/forum/ViewPost.jtp?post=5583273&framed=y
> --------------------------------------------------------
>
> NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.
>
--
James
-------
http://radio.weblogs.com/0112098/