I think choice is a better option than filter
from("jms:queue:from")
.choice()
.when(header("head").isEqualTo("B")).to("log:com.acme?level=INFO")
.otherwise().to("jms:queue:from")
.end()
Question
Say I have a queue containing the messages A
, A
, B
, A
, B
, A
. I'd like to log+drop all B
messages, but I'd like to keep all A
messages untouched. So basically I need some type of ignore functionality, rather than a discarding filter.
If that's not available I probably need to do something similar to:
from("jms:queue:from")
.filter(header("head").isEqualTo("B")).to("log:com.acme?level=INFO").end()
.to("jms:queue:from");
This type of thing seems like a fairly common pattern? How do people usually do this type of thing?
Solution
I think choice is a better option than filter
from("jms:queue:from")
.choice()
.when(header("head").isEqualTo("B")).to("log:com.acme?level=INFO")
.otherwise().to("jms:queue:from")
.end()