I have a flat file, in which each line needs to be captured and unmarshalled
into a `POJO`. I am using `Camel` and `Bindy` and utilizing the `Splitter
EIP`. For some reason i am not able to inspect the `POJO` (using a
`Processor`) after the unmarshalling completed. Any suggestions? 

I am trying to debug the `Exchange` inside the `Process` right after both
`Bindy` conversions below. The code never gets invoked (breakpoint never
reaches)

Here is my code:

    from("file://inbox")
        
.setHeader(Exchange.FILE_NAME,simple("${file:name.noext}-${date:now:yyyyMMddHHmmssSSS}.${file:ext}"))
 
                .wireTap("file://ORIGINAL_BACKUP")
                .process(converterProcessor)
                .split(body(String.class).tokenize(System.lineSeparator()))
                .choice()               
                .when(new Predicate() {
                        
                        public boolean matches(Exchange exchange) {
                                
if(exchange.getIn().getBody().toString().startsWith("HEADER1")) return
true;
                                return false;
                        }
                })              
                .unmarshal()
                .bindy(BindyType.Fixed, 
MessageHeaderGroup_HEADER1.class).process(new
Processor() {
                        
                        public void process(Exchange exchange) throws Exception 
{
                                System.out.println("Object: "+ 
exchange.getIn().getBody());
                                
                        }
                }).to("direct:mhg")
                
                .when(new Predicate() {
                        
                        public boolean matches(Exchange exchange) {
                                
if(exchange.getIn().getBody().toString().startsWith("HEADER2")) return
true;
                                return false;
                        }
                })
                .unmarshal()
                .bindy(BindyType.Fixed, 
TransactionHeaderGroup_HEADER2.class).process(new
Processor() {
                        
                        public void process(Exchange exchange) throws Exception 
{
                                System.out.println("Object: "+ 
exchange.getIn().getBody());
                                
                        }
                }).to("direct:trg")
                .otherwise().to("file://outbox");
                

 I am fairly new to `Camel`. I have tried to end the `choice()` using
`endChoice()` but to no avail. If i use a `Filter EIP` (to only use one
possible `Bindy` conversion) i can inspect the `Exchange` in the `Process`
step. But if i switch to a `choice()` with `Predicate` i am not able to.
Thanks for your suggestions!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Inspect-marshalled-Pojo-with-a-Processor-with-Camel-and-Bindy-tp5769982.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to