camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Onur Akdemir (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-9560) RabbitMQ InOut Producer generates a null body response when a correlationId is used
Date Thu, 04 Feb 2016 14:47:39 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-9560?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Onur Akdemir updated CAMEL-9560:
--------------------------------
    Attachment: camel_9560.patch

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

Mime
View raw message