cringe
cringe

Reputation: 13980

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");

Upvotes: 5

Views: 6117

Answers (2)

gogstad
gogstad

Reputation: 3739

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.

Upvotes: 5

Hussain Pirosha
Hussain Pirosha

Reputation: 1376

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.

Upvotes: 4

Related Questions