Hi,


We have an application where in for each client we create a Queue in
RabbitMQ.
(i.e. we create a binding with client id to a common exchange)
So, all messages that are published with binding key as client id will go
to that queue.


There is only single client which subscribes to this Queue.
The queue will get messages at the rate of 100 msgs/sec for example.


RabbitMQ is sending only 1 message at a time to the consumer. Even if we
set the prefetch count as higher value, the messages are delivered only one
by one.
The callback method in consumer can consume only single message.


void *handleDelivery*(java.lang.String consumerTag,
                     Envelope
<http://www.rabbitmq.com/releases/rabbitmq-java-client/v3.1.1/rabbitmq-java-client-javadoc-3.1.1/com/rabbitmq/client/Envelope.html>
envelope,
                     AMQP.BasicProperties
<http://www.rabbitmq.com/releases/rabbitmq-java-client/v3.1.1/rabbitmq-java-client-javadoc-3.1.1/com/rabbitmq/client/AMQP.BasicProperties.html>
properties,
                     byte[] body)
                     throws java.io.IOException


Is there a way in RabbitMQ where in we enable RabbitMQ to send mutiple
messages to consumer at a time. In my case there is only one consumer per
queue. So, by sending mutiple messages to consumer at a time will improve
my performance.


Can someone suggest how I can achieve this.
If rabbitMQ does not support, is there any other way of achieving this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130604/8b872944/attachment.htm>

Search Discussions

  • Emile Joubert at Jun 5, 2013 at 9:10 am
    Hi,

    On 04/06/13 18:45, Vijay Lakshmi wrote:
    Is there a way in RabbitMQ where in we enable RabbitMQ to send mutiple
    messages to consumer at a time. In my case there is only one consumer
    per queue. So, by sending mutiple messages to consumer at a time will
    improve my performance.

    (I assume by performance you mean throughput and lower overhead rather
    than latency.)


    You can batch messages by combining multiple logical messages into one
    message in the publisher. Consumers will then have to decompose this
    message to retrieve individual logical messages. RabbitMQ does not offer
    built-in support for this. Bear in mind that the broker deals with
    batched rather than the individual component messages for purposes of
    message acknowledgement, rejection, TTL, etc.


    You should use a message composition/decomposition scheme that makes
    sense in your application. Simple concatenation may be sufficient if you
    record message boundaries in a header. If messages are in XML format
    then you could wrap them in a container element.




    -Emile
  • Emile Joubert at Jun 5, 2013 at 9:28 am

    On 04/06/13 18:45, Vijay Lakshmi wrote:
    RabbitMQ is sending only 1 message at a time to the consumer. Even if we
    set the prefetch count as higher value, the messages are delivered only
    one by one.

    Actually the broker may be sending multiple messages to the consumer,
    even though the consumer only processes one message at a time. If you
    set the prefetch-count to a large number then there should be minimal
    latency between invocations of handleDelivery().
  • Robert Raschke at Jun 5, 2013 at 8:13 pm
    Isn't this what the prefetch count is all about?
    On Jun 4, 2013 6:48 PM, "Vijay Lakshmi" wrote:

    Hi,

    We have an application where in for each client we create a Queue in
    RabbitMQ.
    (i.e. we create a binding with client id to a common exchange)
    So, all messages that are published with binding key as client id will go
    to that queue.

    There is only single client which subscribes to this Queue.
    The queue will get messages at the rate of 100 msgs/sec for example.

    RabbitMQ is sending only 1 message at a time to the consumer. Even if we
    set the prefetch count as higher value, the messages are delivered only one
    by one.
    The callback method in consumer can consume only single message.

    void *handleDelivery*(java.lang.String consumerTag,
    Envelope <http://www.rabbitmq.com/releases/rabbitmq-java-client/v3.1.1/rabbitmq-java-client-javadoc-3.1.1/com/rabbitmq/client/Envelope.html> envelope,
    AMQP.BasicProperties <http://www.rabbitmq.com/releases/rabbitmq-java-client/v3.1.1/rabbitmq-java-client-javadoc-3.1.1/com/rabbitmq/client/AMQP.BasicProperties.html> properties,
    byte[] body)
    throws java.io.IOException

    Is there a way in RabbitMQ where in we enable RabbitMQ to send mutiple
    messages to consumer at a time. In my case there is only one consumer per
    queue. So, by sending mutiple messages to consumer at a time will improve
    my performance.

    Can someone suggest how I can achieve this.
    If rabbitMQ does not support, is there any other way of achieving this.




    _______________________________________________
    rabbitmq-discuss mailing list
    rabbitmq-discuss at lists.rabbitmq.com
    https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130605/215fb1a3/attachment.htm>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedJun 4, '13 at 5:45p
activeJun 5, '13 at 8:13p
posts4
users3
websiterabbitmq.com
irc#rabbitmq

People

Translate

site design / logo © 2017 Grokbase