Daniel Urbaniak
Daniel Urbaniak

Reputation: 117

Apache camel, callback message on filter

I'm new in Camel technology and I'm using ProducerTemplate to send object to the queue. I have defined RouteBuilder object and I'm using filter in route deffinition. My question is what should I use to give feedback message when filter would return false and don't let my message go to the queue. How can I get notification from templateProducer that my message was invalid?

Example pseudo code:

@Produce
ProducerTemplate template;

class Route extends RouteBuilder
{
...
    public void configure() throws Exception
    {
        from("direct:start")
        .filter(...)
        .to("direct:myQueue");
    }
...
}

template.sendBodyAndHeaders(new Route(), myBody, myHeaders);

Upvotes: 0

Views: 440

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55750

See the documentation, there is a section knowing if the message was filtered or not

To get that as a feedback either use the methods on the producer template that returns an Exchange, or change the route to set the filtered exchange property as a body or header to use as a response.

And use the request methods on producer template as they are for InOut.

Upvotes: 1

Related Questions