// Create a new copy of the message so that response MessageProcessors don't end up screwing up the reply
returnMessage = new DefaultMuleMessage(returnMessage.getPayload(), returnMessage, muleContext);
// Create the replyTo event asynchronous
MuleEvent replyToEvent = new DefaultMuleEvent(returnMessage, event.getEndpoint(), event.getSession(), event.getProcessingTime());
// carry over properties
List<String> responseProperties = endpoint.getResponseProperties();
for (String propertyName : responseProperties)
{
Object propertyValue = event.getMessage().getInboundProperty(propertyName);
if (propertyValue != null)
{
replyToEvent.getMessage().setOutboundProperty(propertyName, propertyValue);
}
}
// dispatch the event
try