camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] [Updated] (CAMEL-8486) Producer should not bind exchange to queue
Date Wed, 06 May 2015 11:13:00 GMT


Claus Ibsen updated CAMEL-8486:
    Issue Type: Improvement  (was: Bug)

> Producer should not bind exchange to queue
> ------------------------------------------
>                 Key: CAMEL-8486
>                 URL:
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-rabbitmq
>    Affects Versions: 2.15.0
>            Reporter: Raymond Cuenen
>             Fix For: 2.16.0
> The {{RabbitMQConsumer}} and {{RabbitMQProducer}} classes both use the {{declareExchangeAndQueue(Channel)}}
method of the {{RabbitMQEndpoint}} class, where an exchange always is declared and when the
{{getQueue}} method does not return {{null}} (line 222) a queue is declared and bound to the
> First the {{getQueue}} method cannot return {{null}}, since the underlying parameter
is initialized at line 75 and as far as I know cannot be set to {{null}} by an URI specification.
> The fact that both the consumer and producer _connect_ the same way is wrong I think.
A producer should always publish to a queue or an exchange, while a consumer always consumes
from a queue, which optionally can be bound to an exchange.
> I would suggest to make separate declare methods for consumers and producers.
> For consumers:
> * always declare exchange (because of component URI specification)
> * always declare queue (specified name or _random_)
> * bind queue to exchange
> ** basicConsume(<queue>, ...)
> For producers:
> * only declare exchange when no queue specified
> ** basicPublish(<exchange>, routingKey, ...)
> * only declare queue when specified (ignore exchange in URI specification)
> ** basicPublish("", <queue>, ...)
> Unless the {{declare=false}} property is specified ofcourse. Note that the binding still
needs to be performed for a consumer (even when the queue and the exchange are not declared)
> With this the processing of the camel exchange for a producer might have to be changed
also; the current implementation always publishes to the exchange, but it has to publish to
the queue (exchange="", routingKey=<queue>) in the case a queue is specified.
> Because the current implementation also creates a binding between a (random named) queue
and an exchange the RabbitMQ broker is left with unused bounded queues every time the application
is started, which results in a new random queue being created. The created queues with their
bindings are not deleted after the application stops (might be a bug in the broker. I'm not

This message was sent by Atlassian JIRA

View raw message