Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference bewteen wiretap and multicast in Apache Camel

The default behaviour of wireTap and multicast in Camel seems to be similar. That is both of them helps in processing the same message in different ways. Then what is the main difference between wireTap and multicast?

like image 970
KayV Avatar asked Jan 05 '17 10:01

KayV


Video Answer


2 Answers

@Srikanth -

I don't think you can achieve concurrency by using wireTap

It is not quite correct. Concurrency will be there with WireTap as well as with Multicast with parallel processing.

It is main purpose of WireTap. As example for logging or auditing outside of main thread to do not slow main thread for non-functional operations.

Difference is:

  • WireTap is "one-way fork". Message goes to wire-tapped endpoint in different thread parallel to main and there is no way to get response back from it to main thread.

    Also it is possible to send to the wire-tapped endpoint other than main body, headers etc.

  • With Multicast it is possible to "split-then-aggregate" results in main thread after parallel or sequential processing.

    Also it is not limited how many endpoints will be multicasted, while WireTap can have only one endpoint to send to.

like image 87
Vadim Avatar answered Oct 17 '22 08:10

Vadim


The wireTap component sends the message to just one route while the main flow continues.

The multicast router sends the message through multiple routes and waits for all of them to continue before the main flow can continue with the next message processor.

In the case of the old and deprecated multicast router, that happens synchronously, meaning that the main flow has to wait for the sum of all the routes execution times.

In 3.5 a new multicasting router called was introduced which does the same thing but in parallel, making the main flow only way for the slowest route.

like image 2
Hari Avatar answered Oct 17 '22 09:10

Hari