spring-projects/spring-xd — pull request #896 by markfisher (2014-05-27 20:04:13+00:00)
Title: XD-1416 Activate tap only when 1 or more consumers

When a module that begins with a tap channel (e.g. tap:stream:foo > log) is deployed,
a corresponding ZooKeeper node will be created under /xd/taps if not already present.

The AbstractMessageBusBinderPlugin has a TapListener that reacts to the addition of
such a node by "activating" the tap. Activation is simply the addition of the WireTap
interceptor on the output channel of the module being tapped along with the binding of
a pub/sub producer to that WireTap's channel. That logic remains the same, but has
simply been made lazy, triggered on-demand only when a tap has at least one consumer.

When the last consuming module for a given tap is undeployed, the ZooKeeper node for that
tap is deleted. The TapListener then reacts by removing the associated WireTap interceptor.