use of org.apache.camel.component.spring.integration.SpringIntegrationMessage in project camel by apache.
the class SpringIntegrationConverter method toSpringMessage.
@Converter
public static org.springframework.messaging.Message<?> toSpringMessage(final org.apache.camel.Message camelMessage) throws Exception {
if (camelMessage instanceof SpringIntegrationMessage) {
SpringIntegrationMessage siMessage = (SpringIntegrationMessage) camelMessage;
org.springframework.messaging.Message<?> message = siMessage.getMessage();
if (message != null) {
return message;
}
}
// Create a new spring message and copy the attributes and body from the camel message
MessageHeaders messageHeaders = new MessageHeaders(camelMessage.getHeaders());
return new GenericMessage<Object>(camelMessage.getBody(), messageHeaders);
}
Aggregations