private void processResponse( Exchange exchange, Object body, SalesforceException ex, AsyncCallback callback) { final Message out = exchange.getOut(); if (ex != null) { exchange.setException(ex); } else { out.setBody(body); } // copy headers and attachments out.getHeaders().putAll(exchange.getIn().getHeaders()); out.getAttachments().putAll(exchange.getIn().getAttachments()); // signal exchange completion callback.done(false); }
@Override public void copyFrom(org.apache.camel.Message that) { // must initialize headers before we set the JmsMessage to avoid Camel // populating it before we do the copy getHeaders().clear(); boolean copyMessageId = true; if (that instanceof JmsMessage) { JmsMessage thatMessage = (JmsMessage) that; this.jmsMessage = thatMessage.jmsMessage; if (this.jmsMessage != null) { // for performance lets not copy the messageID if we are a JMS message copyMessageId = false; } } if (copyMessageId) { setMessageId(that.getMessageId()); } setBody(that.getBody()); getHeaders().putAll(that.getHeaders()); getAttachments().putAll(that.getAttachments()); }