Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use Camel Wiretap or SEDA?

In my Camel Route I need to send message to a JMS when an Exception hits my onException handlers. To speed up the main route, I try to send the messages asynchronously via a Wiretap

I try to use something like this:

onException().handled(true).logHandled(true)
  .wiretap("seda:another_queue").end();
...
from("seda:another_queue?concurrentConsumers=5")
  .to("jms:queue_for_my_exception_messages");

Is it necessary to use the Wiretap, or could I go with just the SEDA queues like this:

onException().handled(true).logHandled(true)
  .to("seda:another_queue").end();
...
from("seda:another_queue?concurrentConsumers=5")
  .to("jms:queue_for_my_exception_messages");
like image 520
cringe Avatar asked Aug 08 '14 08:08

cringe


People also ask

What is the use of wiretap in camel?

Wire Tap from the EIP patterns allows you to route messages to a separate location while they are being forwarded to the ultimate destination.

What is direct and SEDA in camel?

While the Direct and Direct-VM components take a synchronous approach to joining routes, SEDA does the opposite. It allows routes to be connected in an asynchronous way; that is, when a Camel route publishes a message to a seda: endpoint, the message is sent and control is returned immediately to the calling route.

What is camel SEDA?

SEDA is an architecture. The SEDA component in Camel uses in-memory queues in your process and are a separate component in order to distinguish them from the other queue component in Apache camel, namely the JMS component.

What is direct in Apache Camel?

Contents. The Direct component provides direct, synchronous invocation of any consumers when a producer sends a message exchange. This endpoint can be used to connect existing routes in the same camel context. The SEDA component provides asynchronous invocation of any consumers when a producer sends a message exchange.


2 Answers

You do not need to use wiretap. Only seda-queues shall work.

Wiretap pattern should be used where you want to intercept messages between components for analysis or debugging purpose.

like image 111
Hussain Pirosha Avatar answered Oct 02 '22 21:10

Hussain Pirosha


An important difference between Wiretap and SEDA is that when consuming from polling consumers (e.g. file or ftp) only wiretap is fire-and-forget.

When a thread consuming from a polling consumer reaches a .to(seda:xx) it will hand off the exchange and continue the route as expected or consume new exchanges from the endpoint. The exchange delivered to the seda endpoint will be commited to the originating Consumer by the seda thread and not the original consumer thread. That means that if you for instance have delete=true in your polling consumer endpoint definition, the file will not be deleted before the seda thread has finished.

like image 29
gogstad Avatar answered Oct 02 '22 21:10

gogstad