[rabbitmq-discuss] Unable to connect multiple consumers to a queue bound to fanned out exchange

Uday Mitra udaymitra4u at gmail.com
Thu Jul 14 20:19:25 BST 2011


JMX API allows me to create a consumer from session using
session.createConsumer().
I looked at QPID's implementation for session (AMQSession.java), and here is
what I found:

public MessageConsumer createConsumer(Destination destination) throws
JMSException
    {
        checkValidDestination(destination);

        return createConsumerImpl(destination, _prefetchHighMark,
_prefetchLowMark, false, (destination instanceof Topic), null, null,
                                  ((destination instanceof AMQDestination)
&& ((AMQDestination)destination).isBrowseOnly()), false);
    }


protected C createConsumerImpl(final Destination destination, final int
prefetchHigh,
                                                 final int prefetchLow,
final boolean noLocal, final boolean exclusive, String selector, final
FieldTable rawSelector,
                                                 final boolean noConsume,
final boolean autoClose) throws JMSException
    {
......
}

When I use the properties for queue1, its creating an object of type
AMQAnyDestination.java which implements Topic. So, (destination instanceof
Topic) => true. And this will set the consumer as exclusive.

I wonder if the AMQP design is such that fanout is considered an exchange
and so we cannot share the queue?


On Thu, Jul 14, 2011 at 5:28 AM, Simon MacMullen <simon at rabbitmq.com> wrote:

> On 14/07/11 13:15, Simon MacMullen wrote:
>
>> On 14/07/11 01:11, Mitra77 wrote:
>>
>>> I get the following message:
>>> "Queue message_queue1 has an exclusive consumer. No more consumers
>>> allowed."
>>>
>>
>> RabbitMQ never returns that exact error message. QPid does though. Are
>> you sure you're using RabbitMQ?
>>
>
> On 14/07/11 01:12, Mitra77 wrote:
> > I am using QPID, but I figured if this is doable in RabbitMQ, then it
> should
> > be possible in QPID too.
> > Am I missing something here?
>
> Oops, missed that bit. Both QPid and RabbitMQ have the concept of an
> "exclusive" consumer - a consumer which won't let anything else share the
> queue it's consuming from. Somehow you're inadvertently creating one; it
> sounds like you don't want to.
>
> Unfortunately I'm no expert on the JMS API (understatement); it's not
> obvious how you might create a non-exclusive consumer (I would have expected
> that would be the default, but hey...)
>
>
> Cheers, Simon
>
> --
> Simon MacMullen
> RabbitMQ, VMware
> ______________________________**_________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.**rabbitmq.com<rabbitmq-discuss at lists.rabbitmq.com>
> https://lists.rabbitmq.com/**cgi-bin/mailman/listinfo/**rabbitmq-discuss<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/20110714/394418e6/attachment.htm>


More information about the rabbitmq-discuss mailing list