Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Achieving fast consumption rate

  1. #1

    Default Achieving fast consumption rate

    Hi,

    With RabbitMQ and Spring AMQP, I have to achieve is a faster consumption of each message. The scenario is like this:

    I have to send emails/SMSes to different people after consuming the messages internally. I want to just post a message and consume it faster by having multiple consumers ready. The message should be consumed only by one consumer…

    Should I make a no. of consumers using a shared rabbitmq queue in which each consumer consumes the message posted on the exchange, deletes it from the queue and then after passes that message to a new thread for processing ?

    But having a single queue might hamper the performance.

    Is there any other way which can cater my requirement ? any suggestions?

    Regards,
    Kshitiz
    SCBCD (EJB 3.0), SCWCD 1.5, SCJP 1.4

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    You should probably begin by looking at the support for "Message-driven POJOs" that is part of Spring AMQP. It is modeled after Spring's JMS support and provides the same general options for supporting multiple consuming threads per actual Consumer instance.

    Here's a quick link:
    http://static.springsource.org/sprin...single/#d0e288

    You will want to explore the various properties that can be configured on the MessageListener container.

  3. #3

    Default

    Thanks Mark,

    I am using a message Handler which is just a POJO, thanks to Spring AMQP , but now I am facing a situation. I want to hold acknowledging the message so that it stays live on the rabbitMQ till my POJO's handle message gets completed successfully.

    On rabbitMQ mailing list , I have been told to consume with no_ack=false and then send a basic.ack after the processing is complete. How can we achieve that from this POJO or its configuration ?

    Regards,
    Kshitiz Garg
    SCBCD (EJB 3.0), SCWCD 1.5, SCJP 1.4

  4. #4
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    We have transactions covered fully in the RabbitTemplate now, but the asynch use case (message listeners) is not finished yet. However, I think if you set autoAck=false in the message listener container you should see the acks going after the POJO listener has completed.

  5. #5

    Default

    Thanks Dave, I will certainly try that, please let me know later if u come to know about its confirmation
    SCBCD (EJB 3.0), SCWCD 1.5, SCJP 1.4

  6. #6

    Default

    Hi,

    Is there any provision that even if I use a POJO message Handler, the queue name property of the associated listener is inserted programatically?

    Regards,
    Kshitiz Garg
    SCBCD (EJB 3.0), SCWCD 1.5, SCJP 1.4

  7. #7

    Default

    Quote Originally Posted by Mark Fisher View Post
    You should probably begin by looking at the support for "Message-driven POJOs" that is part of Spring AMQP. It is modeled after Spring's JMS support and provides the same general options for supporting multiple consuming threads per actual Consumer instance.

    Here's a quick link:
    http://static.springsource.org/sprin...single/#d0e288

    You will want to explore the various properties that can be configured on the MessageListener container.
    Hi Mark,

    we have a message handler POJO associated with a listener container, If we want different instances/thread of this POJO to handle each new message , is it an automatic process?
    if not, what option I should set on the associated listener..
    SCBCD (EJB 3.0), SCWCD 1.5, SCJP 1.4

  8. #8
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    The listener container has a 'concurrentConsumers' property. Here's the JavaDoc from that setter:
    Code:
    /**
     * Specify the number of concurrent consumers to create. Default is 1.
     * <p>
     * Raising the number of concurrent consumers is recommendable in order to
     * scale the consumption of messages coming in from a queue. However, note
     * that any ordering guarantees are lost once multiple consumers are
     * registered. In general, stick with 1 consumer for low-volume queues.
     */

  9. #9

    Default

    Thanks a lot mark, that's exactly the thing I am looking for as the order of messages is not important and that will enhance the consumption rate ....

    Now I have 20 exchanges, and 4 output queues having 20 concurrent consumers consuming messages coming from each of these 4 queues. Do you think that this mismatch between no. of exchanges and queues, (exchanges are many and queues are few) is not good?

    Actually initially I thought that I will make 4 different type of queues(email/http/sms/ftp) and 4 different types of handlers(email/http/sms/ftp) for each one of those 20 exchanges....

    This design is trying to scale the no. of POJO handler instances vertically , i.e. across different queues (instead of horizontal scaling in one queue, achieved through concurrentConsumers property).

    But it seems that this design is not possible as we bind the handlers with queues while configuring the associated listeners beforehand......Can you please suggest any configuration/design changes to achieve this design, if it's possible?

    Regards,
    Kshitiz Garg
    SCBCD (EJB 3.0), SCWCD 1.5, SCJP 1.4

  10. #10
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    Can you explain the "bindings" you have set up between those Exchanges and Queues?

    By the way, are you using Spring Integration for the various adapters (mail, ftp, etc)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •