You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/01/28 14:52:00 UTC

[jira] [Updated] (CAMEL-17563) wireTap doesn't deep copy attachments

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

Claus Ibsen updated CAMEL-17563:
--------------------------------
    Issue Type: Improvement  (was: Bug)

> wireTap doesn't deep copy attachments
> -------------------------------------
>
>                 Key: CAMEL-17563
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17563
>             Project: Camel
>          Issue Type: Improvement
>          Components: came-core
>    Affects Versions: 3.14.0
>            Reporter: Yasser Zamani
>            Priority: Minor
>
> 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)