0

http://camel.apache.org/splitter.html [1]

From [1] link i saw CamelSplitSize will be on the completed Exchange.

I am learning camel and i would like to know is there a way possible to split the xml file containing 100 rows (assuming 100 rows)

If the split failed while processing the 50th row and we need to show CamelSplitIndex as 50, CamelSplitSize as 100 and CamelSplitComplete as false

.bean(Splitter.class,"saveFile("${camelContext.properties[mySplitSize]}, ${camelContext.properties[mySplitIndex]}, ${camelContext.properties[mySplitComplete]})")

I could not find a way to accomplish this as the link [1] clearly states CamelSplitSize will be stored only on the completed Exchang. Any way to achieve this ??

Vikram
  • 635
  • 1
  • 9
  • 29

1 Answers1

0

If you need this properties you can catch exception that causes stopping splitter and get exchange which caused the exception. There you will find your properties.

 public void show(Exchange exchange) {
    CamelExchangeException camelExceptionCaught = (CamelExchangeException) exchange.getProperty("CamelExceptionCaught");
    System.out.println(camelExceptionCaught.getExchange().getProperty("CamelSplitSize"));
    System.out.println(camelExceptionCaught.getExchange().getProperty("CamelSplitComplete"));
    System.out.println(camelExceptionCaught.getExchange().getProperty("CamelSplitIndex"));
}
c0ld
  • 770
  • 4
  • 15