Enterprise Integration Patterns - Wire Tap
The purpose of the Wire Tap pattern (also known as Tee) is to tap into a message path, make a copy of the original message for alternate independent processing and let the original message flow (unmodified) to the original recipient. This is very useful in cases when a snapshot of a message needs to be taken without altering/disturbing the original message flow.
The wire tap pattern has several applications in the integration space.
Requests/responses to/from a service can be logged, these logged messages can then be used for billing etc.
Monitoring & Analysis
Message requests to a particular service can be monitored easily using the tee. For example, all requests to an order processing service could be monitored and analyzed, high value orders can be forwarded to a special order processing department for further processing.
Parallel Independent processing
Tee can be used to start parallel independent routes to process the incoming message. For instance a service that keeps track of user preferences can be tee'd all catalog browsing requests from a client, this service can then identify the client interest and suggest recommendations in real-time, while the user is browsing the catalog.
tee to [ route-name | service-name ]
route-name := name identifying a route
service-name := name identifying a service
tee to "log-service"
tee to "logger-process"
route "log-service" do
Inserting a tee in a route should not affect the original route. For example if execution of the "log" route fails for some reason, the message from "inbound" should be routed to "po-process".
The intention of the Tee is to get a snapshot of the message exchange and process it independently.