My input file consists of several type of FixedLengthRecord, so I have lots of FixedLengthDataFormat to unmarshal each post.
- I split the body per row
- for the first I should realize which DataFormat I should use, and create an object
- Then unmarshal
Something like this one:
from(myURI)
.split().tokenize("\n")
.process(initializeMyBindyDataFormat)
.unmarshal(bindy)
.end();
But my problem is, I get NPE for that bindy object when I initilize it via a process. But if I create a bindy object before my route definition (before from) it will be work fine. My bindy object is depended on body and I cannot initialize it before route definition. Actually Apache Camel process initialization of bindy object before starting the route
The answer is using .inout Since I want to have unmarshalling in another route, a simple example should be as below:
Thanks jakub-korab for his help.