I want to filter according to header. If some of property is not null, send data from that property to different route.
from(SAVE_RECEIVED_IDS)
.process(exchange -> {
//here i set true for filters because there is faulty data
exchange.getIn().setFault(true); //for PROCESS_FAULTY route
//if filter catches, it should get and send this but it does not come here
exchange.setProperty("faultyOnes","somearraylistOrData"); //for PROCESS_FAULTY route
exchange.setProperty("other fields irrelevant to faulty","somearraylistOrData");//for route GO_NEXT_ROUTE
})
//here i neeed to filter if value is ture
.filter(exchange -> exchange.getIn().isFault()) //it does not come here
.to(PROCESS_FAULTY)
.end() //end for filter
.to(GO_NEXT_ROUTE) //if there is no faulty come here. if there is faulty, after send come here.
.end() //end from()
or should i use choice and when?
.choice()
.when(header("foo").isEqualTo("bar"))
...
.when(header("foo").isEqualTo("chese"))
...
.otherwise()
....
.end(),
like this? I use isFaulty but headers are better or properties? But where do i keep faulty data? Thanks for answers