public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("file:pedidos?delay=5s&noop=true").
split().
xpath("/pedido/itens/item").
log("->>>> ${id} - ${body}").
filter().
//method(new Processor(), "processItem").
xpath("/item/formato[text()='EBOOK']").
log("FICOU ASSIM -> ${id} - ${body}").
marshal().xmljson().
setHeader("CamelFileName", simple("${file:name.noext}.json")).
to("file:saida");
}
});
context.start();
Thread.sleep(20000);
context.stop();
}