[
https://issues.apache.org/jira/browse/CAMEL-7003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13843952#comment-13843952
]
Jason Foster commented on CAMEL-7003:
-------------------------------------
The consumer class already has this capability...
channel.exchangeDeclare(endpoint.getExchangeName(),
endpoint.getExchangeType(),
endpoint.isDurable(),
endpoint.isAutoDelete(),
new HashMap<String, Object>());
// need to make sure the queueDeclare is same with the exchange declare
channel.queueDeclare(endpoint.getQueue(), endpoint.isDurable(), false,
endpoint.isAutoDelete(), null);
channel.queueBind(
endpoint.getQueue(),
endpoint.getExchangeName(),
endpoint.getRoutingKey() == null ? "" : endpoint
.getRoutingKey());
which doesn't seem like a lot of code to add... If anything, the producer side
is more sensitive to exchanges and queues not being there, since if a producer
sends a message to an exchange without a queue being there, it gets black holed
by RabbitMQ (which means messages get lost).
You cannot control the order of startup of components OUTSIDE of camel, so
consumers that don't run in camel but still want to read messages from
producers inside camel, might start after camel in some cases.
Can this please be revisited?
> RabbitMQ Producer cannot create exchanges, queues
> -------------------------------------------------
>
> Key: CAMEL-7003
> URL: https://issues.apache.org/jira/browse/CAMEL-7003
> Project: Camel
> Issue Type: Bug
> Components: camel-rabbitmq
> Affects Versions: 2.12.1
> Environment: RabbitMQ 3.2.0 on CentOS 6.4 (running in VMWare
> Workstation 9.0.2 build-1031769)
> Camel 2.12.1 running in Eclipse Helios on Windows 7
> Reporter: Jason Foster
> Assignee: Willem Jiang
>
> There doesn't seem to be a way to have the producer declare an exchange or a
> queue. The following route demonstrates this problem:
> from("stream:in?promptMessage=Enter message payload: ")
>
> .to("rabbitmq://<server>:<port>/direct?queue=defect&username=guest&password=guest");
> There also is no way for the producer to use the default exchange, (which has
> no name). You cannot set an exchange name as a header with an empty string,
> and specifying 'direct' on the exchange uri also doesn't work. However, the
> consumer appears to work and will declare at least queues, even on the
> default exchange.
> The producer appears to only work with previously declared exchanges and
> queues, which isn't practical, especially in recovery situations, since you
> cannot guarantee the order things will start (producer vs. consumer) and the
> producer doesn't attempt any type of re-delivery in the case that the
> exchange/queue doesn't exist, nor does it indicate via logging or exceptions
> that there is a problem with delivery.
> In Rabbit, creating exchanges and queues are both idempotent operations, so
> it wouldn't hurt to call the methods to declare the exchange and queue,
> regardless of whether they previously existed. If you set up an endpoint to
> a non-existent queue and want to use the default direct exchange, you can't
> do that with this component.
> If an exchange and queue are created outside the component, (say by a
> consumer or using rabbitmq management console) then the producer works
> correctly.
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)