Integration / Apache Camel Interview Questions
How does the Wire Tap EIP work and what is it used for?
The Wire Tap sends a copy of the current message to a secondary endpoint asynchronously while allowing the original message to continue through the route unchanged. It is used for auditing, logging to an append-only store, event sourcing side-channels, and monitoring without adding latency to the main processing path.
from("jms:queue:orders")
.wireTap("jms:topic:audit-log") // async copy to audit log
.to("direct:process-order"); // main flow continues
// Wire tap with body transformation for the copy:
from("direct:payment")
.wireTap("jms:queue:payment-audit")
.newExchangeBody(simple("Order ${header.orderId} received at ${date:now:yyyy-MM-dd}"))
.to("direct:process-payment");The wire tap sends a shallow copy of the Exchange with a new thread from the routing thread pool. The original Exchange continues immediately — there is no waiting for the tap. In Camel 3.x the tap always uses InOnly semantics; any response from the tap endpoint is discarded. The tap copy shares message headers with the original by default; use newExchangeBody() or onPrepare() to customise the tap message.
More Related questions...