camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnaud CHOTARD (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-9560) RabbitMQ InOut Producer generates a null body response when a correlationId is used
Date Tue, 02 Feb 2016 17:08:40 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-9560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15128574#comment-15128574
] 

Arnaud CHOTARD commented on CAMEL-9560:
---------------------------------------

Maybe replacing exchange.getOut() by exchange.hasOut() should resolve the bug 

> 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
>
> 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)

Mime
View raw message