« Return to Thread: load balancing

Re: load balancing

by Dexter Tad-y :: Rate this Message:

Reply to Author | View in Thread

Hi,

ActiveMQ supports a Stomp SUBSCRIBE header called 'activemq.prefetchSize'. You might want to set this to 1 so that there is only one message pending for the consumer. This minimizes the number of unack'd messages at a time.

A solution I can think of to the NACK requirement is to wrap your ACK frame and SEND (for re-enqueue) under one transaction. This way, the message goes back to the queue. The drawback to this approach is that the message might get sent back to the same consumer.

To solve the problem of the above solution, you can extend it by implementing a routing mechanism:
  1. all consumer subscribes from a main queue
  2. each consumer is assigned to listen to its own queue
  3. if a consumer decides to NACK a message (either from the main queue or its own), it should send the message to the next consumer.

This solution solves the problem where the same message goes to the same consumer who NACK'd the message in the first place. But it adds complexity to the solution where in each consumer is required to know the queue(s) of the other consumer(s).

Cheers!

Dex


--- On Sat, 11/15/08, Vadim Zaliva <krokodil@...> wrote:

> From: Vadim Zaliva <krokodil@...>
> Subject: [stomp-user] load balancing
> To: user@...
> Date: Saturday, November 15, 2008, 12:37 PM
> Hi!
>
> I am trying to use ActiveMQ and Stomp protocol to implement
> scenario where are multiple consumers are processing
> messages from single queue. I want to make sure that only
> one consumer will get the message, and he must acknowledge
> it, so the message will get back to queue if it has not
> acknowledged for some time.
>
> One of problems I see is that there is no NAK command in
> stomp. So, once I have received the message I could not send
> NAK to reject it back to the queue, so it will be delivered
> to another consumer.
>
> Another problem, or rather a question, is what happens to
> not ACK-ed messages. Are they delivered to other consumers
> and under what conditions?
>
> Perhaps I can use stomp transactions, but I am not sure how
> they apply to receiving messages.
>
> Sincerely,
> Vadim
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email


     

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: load balancing