[
https://issues.apache.org/jira/browse/CAMEL-9560?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-9560.
--------------------------------
Resolution: Fixed
Assignee: Claus Ibsen
Thanks Arnaud for the patch. Keep testing rabbitmq and work on patches for it.
> RabbitMQ InOut Producer generates a null body response when a correlationId
> is used
> -----------------------------------------------------------------------------------
>
> Key: CAMEL-9560
> URL: https://issues.apache.org/jira/browse/CAMEL-9560
> Project: Camel
> Issue Type: Bug
> Components: camel-rabbitmq
> Affects Versions: 2.16.2
> Reporter: Arnaud CHOTARD
> Assignee: Claus Ibsen
> Fix For: 2.16.3, 2.17.0
>
> Attachments: camel_9560.patch
>
>
> The use case uses a correlationId with RabbitMQ InOut Producer :
> {code}
> from("direct:route")
> .setHeader(RabbitMQConstants.EXCHANGE_NAME, constant("exchange"))
> .setHeader(RabbitMQConstants.CORRELATIONID, constant("123"))
> .inOut("rabbitmq://...")
> {code}
> The response always contains a null out body message.
> The problem is located when restoring the original correlation id in
> org.apache.camel.component.rabbitmq.reply.ReplyManagerSupport :
> {code}
> public void processReply(ReplyHolder holder)
> {code}
> {code}
> // restore correlation id in case the remote server messed with it
> if (holder.getOriginalCorrelationId() != null) {
> if (exchange.getOut() != null) {
> exchange.getOut().setHeader(RabbitMQConstants.CORRELATIONID,
> holder.getOriginalCorrelationId());
> } else {
> exchange.getIn().setHeader(RabbitMQConstants.CORRELATIONID,
> holder.getOriginalCorrelationId());
> }
> }
> {code}
> The test exchange.getOut() is always successful because of the lazy creation
> in DefaultExchange.getOut
> {code}
> public Message getOut() {
> // lazy create
> if (out == null) {
> out = (in != null && in instanceof MessageSupport)
> ? ((MessageSupport)in).newInstance() : new DefaultMessage();
> configureMessage(out);
> }
> return out;
> }
> {code}
> The in body message contains the correct response from RabbitMQ. However,
> since the out message will be always created with a null body, the null body
> response will be returned in the pipeline
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)