Pollable Consumer : Start Source if Lifecycle

When binding a `MessageSource`, start it if it implements `Lifecycle`.

Resolves #1189
This commit is contained in:
Gary Russell
2018-01-23 13:14:01 -05:00
committed by Oleg Zhurakousky
parent c1749ca866
commit e040cf02b4

View File

@@ -317,6 +317,9 @@ public abstract class AbstractMessageChannelBinder<C extends ConsumerProperties,
getPolledConsumerRecoveryCallback(resources.getErrorInfrastructure(), properties));
}
postProcessPollableSource(bindingTarget);
if (resources.getSource() instanceof Lifecycle) {
((Lifecycle) resources.getSource()).start();
}
return new DefaultBinding<PollableSource<MessageHandler>>(name, group, inboundBindTarget,
resources.getSource() instanceof Lifecycle ? (Lifecycle) resources.getSource() : null) {