Is there a way in Spring boot Apache camel to know if the input failed to meet the requirement in a .filter()
?
@Override
public void configure() throws Exception {
// @formatter:off
from("file://data/inputdir")
.log("Checking ${file:name}")
.filter(simple("${file:ext} == 'jpg'"))
.to("file://data/outputidr/valid")
.log("Processed in JPG! ${file:name}")
.end()
.filter(simple("${file:ext} == 'txt'"))
.to("file://data/outputidr/validtxt")
.log("Processed in TXT! ${file:name}")
.end()
// @formatter:on
}
I don't know if there is any method available to see if the .filter()
is already done checking. I want to add in the end something like .log("${file:name} is not processed");
You can assign to a variable of filter result there is a basic example which I write you need change ${body} as ${file:name}
from("timer:hello?repeatCount=1")
.setBody(constant("helloworld"))
.filter(simple("${body} == 'helloworld1'")).statusPropertyName("anyVariable")
.log("do something")
.end()
.log("process status of '${body}' ${exchangeProperty.anyVariable}");
output is
(Camel (camel-15) thread #11 - timer://hello) process status of 'helloworld' false