[
https://issues.apache.org/jira/browse/CAMEL-26016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18130966#comment-18130966
]
Claus Ibsen commented on CAMEL-26016:
-------------------------------------
Fix in https://github.com/apache/camel/pull/28358
_Claude Code on behalf of davsclaus_
> camel-nats - a consumer reply that does not convert to bytes is dropped, and
> JetStream replies go to the ack subject
> --------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26016
> URL: https://issues.apache.org/jira/browse/CAMEL-26016
> Project: Camel
> Issue Type: Bug
> Components: camel-nats
> Affects Versions: 4.18.0, 4.22.0, 4.23.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while checking the body types of the nats component for the catalog
> (CAMEL-24961).
> h4. 1. A consumer reply that does not convert to bytes is dropped silently
> A nats consumer with {{exchangePattern=InOut}} answers a message that has a
> reply subject with the body the route ends with, converted with
> {{getBody(byte[].class)}}, and publishes it only when that is not null
> ({{NatsConsumer}}, main 56aa5f4970a6, lines 391-398). A body that does not
> convert to bytes, such as a Map, a POJO or no body, sends no reply and logs
> nothing, so the requester times out with no hint. (The producer sends the
> same bodies as their toString().)
> Checked on 4.24.0-SNAPSHOT with {{camel run}} against {{camel infra run
> nats}}: services that end with text, bytes or a stream reply; services that
> end with a Map, a POJO or no body do not reply, and the request fails
> ({{CancellationException: Future cancelled, response not registered in
> time}}).
> *Proposed change*: fail the exchange, or log a warning, when the reply body
> does not convert to bytes.
> h4. 2. A JetStream consumer with exchangePattern=InOut publishes its reply to
> the ack subject
> With JetStream, the reply subject of a delivered message is its ack subject,
> {{$JS.ACK...}}. A nats consumer with {{jetstreamEnabled=true}} and
> {{exchangePattern=InOut}} takes it as the reply subject, and after the
> message is acked it publishes the body the route ends with to the ack subject
> ({{NatsConsumer}}, main 56aa5f4970a6, lines 391-398).
> Checked on 4.24.0-SNAPSHOT with {{camel run}} against {{camel infra run
> nats}} (JetStream on): a consumer on {{orders}} with
> {{jetstreamName=ORDERS}}, {{durableName=c1}} and {{exchangePattern=InOut}}
> whose route ends with "reply-body", and a core subscription on {{$JS.ACK.>}}:
> it receives "+ACK" and then "reply-body" on the same ack subject.
> *Proposed change*: do not reply to a JetStream message, or say in the docs
> that InOut is for core NATS only.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)