spring-projects/spring-xd — pull request #1324 by garyrussell (2014-12-05 22:04:46+00:00)
Title: XD-2429 Bind Producer Before Consumer

JIRA: https://jira.spring.io/browse/XD-2429

When tapping a fire hose, it was possible to get `Dispatcher has no subscriber`
errors on the first module's `output` channel.

This was because the `AbstractMessageBusBinderPlugin` bound the consumer (`input`)
first and messages start flowing before the producer (`output` is bound.
If the output channel is a `SubscribableChannel`, `Dispatcher has no subscribers`
resulted.

Change the bind order so that the output channel is bound first, then the
inbound channel. Similar to the way we bind modules right-to-left when using
a `LocalMessageBus`, we need to bind the module itself right-to-left.

This is only a problem when a stream starts with a tap because, with a "normal" stream,
the last module to be bound is the source, and we don't start it until the source itself
is bound; hence no messages flow to the downstream processors so it doesn't matter what
order their channels are bound.

With a tap, messages can start flowing from the tap as soon as the input channel is bound to the bus.