Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dismiss message in Apache Camel

Tags:

apache-camel

Hope this doesn't sound ridiculous, but how can I discard a message in Camel on purpose?

Until now, I sent them to the Log-Component, but meanwhile I don't even want to log the withdrawal.

Is there a /dev/null Endpoint in Camel?

like image 480
Franz Avatar asked May 16 '13 08:05

Franz


2 Answers

With credit to my colleague (code name: cayha)...

You can use the Stub Component as a camel endpoint that is equivalent to /dev/null.

e.g.

activemq:route?abc=xyz

becomes

stub:activemq:route?abc=xyz

Although I am not aware of the inner workings of this component (and if there are dangers for memory leaks, etc), it works for me and I can see no drawbacks in doing it this way.

like image 69
vikingsteve Avatar answered Nov 17 '22 17:11

vikingsteve


You can use the message filter eip to filter out unwanted messages. http://camel.apache.org/message-filter

There is no dev/null, component.

Also there is a < stop /> you can use in the route, and when a message hit that, it will stop continue routing.

And the closest we got on a dev/null, is to route to a log, where you set logLeve=OFF as option.

like image 28
Claus Ibsen Avatar answered Nov 17 '22 16:11

Claus Ibsen