Camel with predefined exchange, parameters for queue xx in vhost '/' not equivalent

495 views
Skip to first unread message

Arjun Panday

unread,
Sep 10, 2014, 11:40:51 AM9/10/14
to rabbitm...@googlegroups.com
Dear community,

I'm writing an exploratory prototype with Camel (version 2.13.2) and RabbitMQ (version 3.2.4) and I have problems connecting a camel consumer to a pre-provisionned queue. 

My RabbitMQ instance is up and running, and I have declared the following:

rabbitmqadmin -u admin -p xxx declare queue name=qbsi auto_delete=true durable=true
rabbitmqadmin -u admin -p xxx declare exchange name=xbsi durable=true type=direct
rabbitmqadmin -u admin -p xxx declare binding source=xbsi destination_type=queue routing_key=bsi destination=qbsi

and sent one message to the qbsi queue

here's the RabbitMQ info about the queues and exchanges:

rabbitmqadmin -u admin -p xxx list queues  
+-------+------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+
| vhost | name | auto_delete | consumers | durable | exclusive_consumer_tag |     idle_since      | memory | messages | messages_ready | messages_unacknowledged |        node         | policy | status  |
+-------+------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+
| /     | qbsi | True        | 0         | True    |                        | 2014-09-09 16:17:22 | 21792  | 1        | 1              | 0                       | rabbit@c31b433c9c78 |        | running |
+-------+------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+

rabbitmqadmin -u admin -p xxx list exchanges
+-------+--------------------+---------+-------------+---------+----------+
| vhost |        name        |  type   | auto_delete | durable | internal |
+-------+--------------------+---------+-------------+---------+----------+
...
| /     | xbsi               | direct  | False       | True    | False    |
+-------+--------------------+---------+-------------+---------+----------+

rabbitmqadmin -u admin -p xxx list bindings 
+-------+--------+-------------+------------------+-------------+----------------+
| vhost | source | destination | destination_type | routing_key | properties_key |
+-------+--------+-------------+------------------+-------------+----------------+
| /     |        | qbsi        | queue            | qbsi        | qbsi           |
| /     | xbsi   | qbsi        | queue            | bsi         | bsi            |
+-------+--------+-------------+------------------+-------------+----------------+



I then launch my Camel consumer client with the following URI:
rabbitmq://localhost/xbsi?queue=qbsi&username=admin&password=xxx&autoDelete=false

The consumer connects to RabbitMQ (visible in the "connections" tab of the console) but does not consume any message.
After a 5 minutes timeout, I get the following exception:

java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124)
at com.rabbitmq.client.impl.ChannelN.queueDeclare(ChannelN.java:779)
at com.rabbitmq.client.impl.ChannelN.queueDeclare(ChannelN.java:61)
at org.apache.camel.component.rabbitmq.RabbitMQConsumer.doStart(RabbitMQConsumer.java:63)
...
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - parameters for queue 'qbsi' in vhost '/' not equivalent, class-id=50, method-id=10)
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)


I have tried a few more URI combinations, like setting autoDelete=true in case it was refering to the queue rather than the exchange, or specifying routingKey=bsi&exchangeType=direct&durable=true
but I can't seem to find a working combination of parameters.

Any idea of what I'm doing wrong?
Thanks



Simon MacMullen

unread,
Sep 10, 2014, 11:46:01 AM9/10/14
to Arjun Panday, rabbitm...@googlegroups.com
On 10/09/14 16:40, Arjun Panday wrote:
> Dear community,
>
> I'm writing an exploratory prototype with Camel (version 2.13.2) and
> RabbitMQ (version 3.2.4) and I have problems connecting a camel consumer
> to a pre-provisionned queue.
>
> My RabbitMQ instance is up and running, and I have declared the following:
>
> rabbitmqadmin -u admin -p xxx declare queue name=qbsi auto_delete=true
> durable=true

(Out of curiosity, why do you want an auto-delete queue?)

<snip>

> Caused by: com.rabbitmq.client.ShutdownSignalException: channel error;
> protocol method: #method<channel.close>(reply-code=406,
> reply-text=PRECONDITION_FAILED - *parameters for queue 'qbsi' in vhost
> '/' not equivalent*, class-id=50, method-id=10)
> at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
> at
> com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
> at
> com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)
> at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216)
> at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)
>
>
> I have tried a few more URI combinations, like setting autoDelete=true
> in case it was refering to the queue rather than the exchange, or
> specifying routingKey=bsi&exchangeType=direct&durable=true
> but I can't seem to find a working combination of parameters.

So the error message you are seeing is definitely from the queue not
being equivalent. It's not a problem with the exchange or binding.

The simplest way to figure this out is probably to delete the queue,
then let Camel declare it and see what you end up with.

Cheers, Simon

Arjun Panday

unread,
Sep 10, 2014, 12:34:58 PM9/10/14
to rabbitm...@googlegroups.com, apa...@kyriba.com
Thanks a lot Simon.

Indeed I think I was trying to understand the semantics of autodelete of the queue vs exchange and got confused. Works better with autodelete=false on both the exchange and the queue. 

Maybe you can help me clarify a couple of points that i still find confusing:
- should the routingKey be specified the producer or consumer? (currently my producer specifies exchange and routing key while the consumer specifies exchange and queue)
- what happens if a message is sent to an exchange that cannot be routed to a queue (like a wrong routingKey)? It seems that in some cases the message is considered sent by the producer but dropped by rabbit! does this seem possible or am I doing it wrong again?
- do you know why the exception appears only after a 5 minutes timeout for what seems to be a configuration error? 

Thanks again, obviously I'm pretty novice on the subject :)

Cheers,
Arjun

Simon MacMullen

unread,
Sep 10, 2014, 1:04:53 PM9/10/14
to Arjun Panday, rabbitm...@googlegroups.com
On 10/09/14 17:34, Arjun Panday wrote:
> Thanks a lot Simon.
>
> Indeed I think I was trying to understand the semantics of autodelete of
> the queue vs exchange and got confused. Works better with
> autodelete=false on both the exchange and the queue.
>
> Maybe you can help me clarify a couple of points that i still find
> confusing:

I can try, but bear in mind I know almost nothing of Camel: my answers
will be very RabbitMQ specific.

> - should the routingKey be specified the producer or consumer?
> (currently my producer specifies exchange and routing key while the
> consumer specifies exchange and queue)

Probably both. The idea is that each end can declare as much as it knows
about. Sometimes publishers know which queue(s) they should be sending
to, other times they are just broadcasting for interested consumers (of
which there may be 0 to many).

> - what happens if a message is sent to an exchange that cannot be routed
> to a queue (like a wrong routingKey)? It seems that in some cases the
> message is considered sent by the producer but dropped by rabbit! does
> this seem possible or am I doing it wrong again?

The producer can detect if a published message was not routed to any
queues using the mandatory flag. Camel may not expose that.

Or if it know what queues should get the message, it can make sure to
declare everything.

> - do you know why the exception appears only after a 5 minutes timeout
> for what seems to be a configuration error?

Suspect that's a Camel issue - the server should certainly return an
error immediately.

Cheers, Simon
> --
> You received this message because you are subscribed to the Google
> Groups "rabbitmq-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to rabbitmq-user...@googlegroups.com
> <mailto:rabbitmq-user...@googlegroups.com>.
> To post to this group, send email to rabbitm...@googlegroups.com
> <mailto:rabbitm...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Arjun Panday

unread,
Sep 10, 2014, 1:08:39 PM9/10/14
to rabbitm...@googlegroups.com, apa...@kyriba.com
Thank you so much for your quick replies, it helps a lot :)

Cheers
Reply all
Reply to author
Forward
0 new messages