camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernard Ligny <bernard.li...@gmail.com>
Subject Re: OriginalMsg - Why is (only) the body cloned for JMS messages ?
Date Thu, 03 May 2012 07:52:41 GMT
If I need to copy:
- the body
- the headers
- the attachements
Then, given the code behind the copy() method (see below), I do not see any
objection of invoking the whole copy method.
Can you also clarify why it could not work with all JMS implementations, eg
which portion of code, being part of CopyFrom(), may cause problem ? 
Because of the copy of the message ID (which could then be not unique) ??



public void copyFrom(Message that) {
        if (that == this) {
            // the same instance so do not need to copy
            return;
        }

        setMessageId(that.getMessageId());
        setBody(that.getBody());
        if (hasHeaders()) {
            getHeaders().clear();
        }
        if (that.hasHeaders()) {
            getHeaders().putAll(that.getHeaders());
        }
        
        if (hasAttachments()) {
            getAttachments().clear();
        }
        if (that.hasAttachments()) {
            getAttachments().putAll(that.getAttachments());
        }
    }

--
View this message in context: http://camel.465427.n5.nabble.com/OriginalMsg-Why-is-only-the-body-cloned-for-JMS-messages-tp5675413p5682544.html
Sent from the Camel Development mailing list archive at Nabble.com.

Mime
View raw message