Yasser Zamani created CAMEL-17563:
-------------------------------------

             Summary: wireTap doesn't deep copy attachments
                 Key: CAMEL-17563
                 URL: https://issues.apache.org/jira/browse/CAMEL-17563
             Project: Camel
          Issue Type: Bug
          Components: came-core
    Affects Versions: 3.14.0
            Reporter: Yasser Zamani


Attachments are just stored in a Map in an internal property of exchange. So 
when Camel copies exchange on wireTap, Attachments is copied by reference and 
so are shared with the main route and so confusing un-deterministic behavior 
will emerge on wireTap when exchange has attachments!

Currently I've workaround this issue as following:

{code:java}
                    
.wireTap("direct:xslt-validation-logging").onPrepare(exchange -> {
                        // deep copy attachments to avoid wiretap added 
attachments to be seen in the original route
                        AttachmentMessage attMsg = 
exchange.getIn(AttachmentMessage.class);
                        attMsg.setAttachments(attMsg.getAttachments());
                    }).end()

{code}

but I think Camel internally MUST do this for me as it's useless to share 
attachments with main route I think.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to