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

Claus Ibsen commented on CAMEL-26015:
-------------------------------------

Fix in https://github.com/apache/camel/pull/28358

_Claude Code on behalf of davsclaus_

> camel-spring-rabbitmq - a reply keeps the content type of the request, and a 
> Message reply has no correlation id
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26015
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26015
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-spring-rabbitmq
>    Affects Versions: 4.18.0, 4.22.0, 4.23.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.24.0
>
>
> Found while checking the body types of the spring-rabbitmq component for the 
> catalog (CAMEL-24961).
> h4. 1. A reply or a forwarded message keeps the content type of the consumed 
> message
> The spring-rabbitmq consumer maps the content type of a message to the 
> {{CamelSpringRabbitmqContentType}} header, and the producer and the consumer 
> reply build the properties of the message they send from that header 
> ({{DefaultMessagePropertiesConverter}}, main 56aa5f4970a6, line 50; 
> {{EndpointMessageListener}}, line 277). So a reply, or a message forwarded by 
> a route, keeps the content type of the consumed message after the body has 
> changed. A byte array sent with the {{text/plain}} of a text request is 
> turned into a String by the requester ({{DefaultMessageConverter}}, line 78), 
> so binary data is decoded as text.
> Checked on 4.24.0-SNAPSHOT with {{camel run}} against {{camel infra run 
> rabbitmq}}:
> * a request "Question" (text/plain) to a consumer whose route ends with a 
> byte array: the requester gets a {{java.lang.String}};
> * the same after {{removeHeader: CamelSpringRabbitmqContentType}} in the 
> consumer route: {{application/octet-stream}} and a byte array;
> * a consumed text message, {{convertBodyTo: byte[]}}, then sent to another 
> queue: it arrives as {{text/plain}} and a String.
> *Proposed change*: let the type of the body decide the content type of a 
> reply, and of a sent message whose body no longer matches the header.
> h4. 2. A reply that is a Spring AMQP Message has no correlation id, so the 
> requester times out
> When the route of a spring-rabbitmq consumer ends with a Spring AMQP 
> {{Message}} as the body, the reply is sent as it is 
> ({{EndpointMessageListener}}, main 56aa5f4970a6, line 274). The correlation 
> id of the request is only set on a reply built by the converter (line 278), 
> so the requester cannot match the reply and times out.
> Checked on 4.24.0-SNAPSHOT with {{camel run}} against {{camel infra run 
> rabbitmq}}: a consumer route that ends with {{MessageBuilder.withBody('Hi 
> from a Message'.bytes).build()}}, and an InOut request with 
> {{replyTimeout=5000}}: {{AmqpReplyTimeoutException: Reply timed out}}.
> *Proposed change*: set the correlation id of the request on a Message reply 
> that has none.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to