문제

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?

도움이 되었습니까?

해결책

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()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top