I am trying to achieve the following in camel:
1. Consume XML from a JMS queue
2. Unmarshall the XML to a java class using jaxb
3. Send the java class to a custom Processor implementation
4. Within the custom Processor implementation call a Java api that returns a set of results potentially containing a mixture of failures and passes.
5. Within the custom Processor loop through the results and depending on the error put the original XML on to one of several queues.
This all works except from within my custom Processor implementation how do I get hold of the original XML without marshalling the Java object that has already been unmarshalled (that seems a bit of a waste)?
I could pass the XML to the processor and then unmarshall inside the Processor but I want as much logic as possible to be in my blueprint camel xml file.
Any help is much appreciated.
Update: the following seems to work in my case:
String originalBody = new String((byte) exchange.getUnitOfWork().getOriginalInMessage().getBody());