Claus Ibsen created CAMEL-24365:
-----------------------------------

             Summary: camel-core - Attachment trait lost when producer creates 
a fresh OUT message (regression from CAMEL-21755)
                 Key: CAMEL-24365
                 URL: https://issues.apache.org/jira/browse/CAMEL-24365
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 4.10.1
            Reporter: Claus Ibsen


CAMEL-21755 (commit df12381957fa, released in 4.10.1) moved attachment storage 
from Exchange-level safe-copy properties to Message-level traits 
(MessageTrait.ATTACHMENTS). This broke any producer that creates a fresh OUT 
message via exchange.getOut(), because AbstractExchange.newOutMessage() calls 
in.newInstance() which returns a blank message with no traits.

The root cause is in AbstractExchange.newOutMessage() which creates a fresh 
message without copying the ATTACHMENTS trait from the IN message. Before 
4.10.1, attachments lived on the Exchange and were naturally shared across all 
messages. After the trait migration, they live on the Message and are silently 
dropped when a new OUT is created.

This affects all producers that use exchange.getOut() to create a response 
message (~127 usages across 30+ components), including camel-http (reported in 
CAMEL-24364), and potentially camel-ssh, camel-sql, camel-cxf-rest, camel-jcr, 
etc.

The JMS component got a per-component workaround in CAMEL-23193 (manually 
copying the trait in JmsMessage.copyFrom()), but SJMS and all other components 
never got it.

The fix belongs in core (AbstractExchange.newOutMessage()) to copy the 
ATTACHMENTS trait from IN to the new OUT message, restoring the pre-4.10.1 
semantics. The per-component workaround in JMS can then be removed.



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

Reply via email to