spring-projects/spring-xd — pull request #1099 by garyrussell (2014-07-22 20:56:48+00:00)
Title: XD-1975 Twitter Dispatcher Has No Subscibers

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

The root cause was the StreamPlugin stopped the bus
(unbound the producer) before the module was stopped.

- separate the unbinding of bus consumers and producers.
- unbind the consumer before stopping the module
- unbind the producer(s) after stopping the module

In addition, the Custom Twitter adapters emitted messages after stop.
Stop does not block so the context may stop the consumer
before the adapter has actually stopped. For example, the
TwitterSearch module has a `` subscribed to the adapter's
channel.

- Don't use an Integration scheduler thread
- Block stop() until the thread has terminated
- Put the adapter in `phase` Integer.MAX_VALUE / 2 so it will be stopped before the consumer.