You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andrea Cosentino (Jira)" <ji...@apache.org> on 2026/09/23 12:10:00 UTC

[jira] [Work started] (CAMEL-24935) camel-pulsar - the producer replaces the message body with the MessageId

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

Work on CAMEL-24935 started by Andrea Cosentino.
------------------------------------------------
> camel-pulsar - the producer replaces the message body with the MessageId
> ------------------------------------------------------------------------
>
>                 Key: CAMEL-24935
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24935
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-pulsar
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>            Priority: Minor
>
> h3. Summary
> The producer overwrites the message body with the {{MessageId}} returned by the broker, so after a
> {{to("pulsar:...")}} the original payload is gone for the rest of the route. This is neither documented
> nor covered by a test.
> h3. Details
> {{PulsarProducer.process}}:
> {code:java}
> messageBuilder.sendAsync()
>         .thenAccept(r -> exchange.getIn().setBody(r))
>         .whenComplete(...)
> {code}
> {{r}} is the {{MessageId}} of the published message, and it replaces the IN body. Consequences for an
> ordinary route:
> * any step after the {{to}} sees a {{MessageId}} instead of the payload;
> * {{.to("pulsar:a").to("pulsar:b")}} publishes a serialized {{MessageId}} to the second topic, because
>   {{PulsarProducer.serialize}} falls back to Java serialization when no type converter applies.
> Nothing in {{pulsar-component.adoc}} mentions it and no test asserts it, so it does not look like a
> deliberate contract - but it has been the behaviour for a long time, so a change needs an upgrade-guide
> entry.
> h3. Proposed fix
> Set the send result on the existing {{CamelPulsarMessageId}} header - the same header the consumer
> already populates from {{Message.getMessageId()}} - and leave the body untouched, which is what every
> other Camel producer does. Document the change in the 4.23 upgrade guide.
> A route that today reads the {{MessageId}} from the body would have to read the header instead; that is
> the compatibility cost, and it is worth confirming that trade is acceptable before merging.
> ----
> _Reported by Claude Code on behalf of oscerd (Andrea Cosentino)._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)