Wire Tap – sending a copy of the message elsewhere
When you want to process the current message in the background (concurrently) to the main route, without requiring a response, the Wire Tap EIP can help. A typical use case for this is logging the message to a backend system. The main thread of execution will continue to process the message through the current route as usual, while Wire Tap allows additional messaging processing to occur outside of the main route.
This recipe will show you how to send a copy of the message to a different endpoint.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.routing.wiretap
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with wireTap
.
How to do it...
Use the wireTap
statement and specify the endpoint URI of where to send a copy of the message.
In the XML DSL, this is written as follows:
<route> <from uri="direct:start"/> <wireTap uri="mock:tapped"/> <to...