Source:
public Binding<PollableSource<MessageHandler>> bindPollableConsumer(String name, String group, final PollableSource<MessageHandler> inboundBindTarget, C properties) { Assert.isInstanceOf(DefaultPollableMessageSource.class, inboundBindTarget); DefaultPollableMessageSource bindingTarget = (DefaultPollableMessageSource) inboundBindTarget; ConsumerDestination destination = this.provisioningProvider.provisionConsumerDestination(name, group, properties); if (HeaderMode.embeddedHeaders.equals(properties.getHeaderMode())) { bindingTarget.addInterceptor(0, this.embeddedHeadersChannelInterceptor); } final PolledConsumerResources resources = createPolledConsumerResources(name, group, destination, properties); bindingTarget.setSource(resources.getSource()); if (resources.getErrorInfrastructure() != null) { if (resources.getErrorInfrastructure().getErrorChannel() != null) { bindingTarget.setErrorChannel(resources.getErrorInfrastructure().getErrorChannel()); } ErrorMessageStrategy ems = getErrorMessageStrategy(); if (ems != null) { bindingTarget.setErrorMessageStrategy(ems); } } if (properties.getMaxAttempts() > 1) { bindingTarget.setRetryTemplate(buildRetryTemplate(properties)); bindingTarget.setRecoveryCallback(getRecoveryCallback(resources.getErrorInfrastructure(), properties)); } postProcessPollableSource(bindingTarget); return new DefaultBinding<PollableSource<MessageHandler>>(name, group, inboundBindTarget, resources.getSource() instanceof Lifecycle ? (Lifecycle) resources.getSource() : null) { @Override public void afterUnbind() { afterUnbindConsumer(destination, this.group, properties); destroyErrorInfrastructure(destination, group, properties); } }; }

Target:
public Binding<PollableSource<MessageHandler>> bindPollableConsumer(String name, String group, final PollableSource<MessageHandler> inboundBindTarget, C properties) { Assert.isInstanceOf(DefaultPollableMessageSource.class, inboundBindTarget); DefaultPollableMessageSource bindingTarget = (DefaultPollableMessageSource) inboundBindTarget; ConsumerDestination destination = this.provisioningProvider.provisionConsumerDestination(name, group, properties); if (HeaderMode.embeddedHeaders.equals(properties.getHeaderMode())) { bindingTarget.addInterceptor(0, this.embeddedHeadersChannelInterceptor); } final PolledConsumerResources resources = createPolledConsumerResources(name, group, destination, properties); bindingTarget.setSource(resources.getSource()); if (resources.getErrorInfrastructure() != null) { if (resources.getErrorInfrastructure().getErrorChannel() != null) { bindingTarget.setErrorChannel(resources.getErrorInfrastructure().getErrorChannel()); } ErrorMessageStrategy ems = getErrorMessageStrategy(); if (ems != null) { bindingTarget.setErrorMessageStrategy(ems); } } if (properties.getMaxAttempts() > 1) { bindingTarget.setRetryTemplate(buildRetryTemplate(properties)); bindingTarget.setRecoveryCallback( getPolledConsumerRecoveryCallback(resources.getErrorInfrastructure(), properties)); } postProcessPollableSource(bindingTarget); return new DefaultBinding<PollableSource<MessageHandler>>(name, group, inboundBindTarget, resources.getSource() instanceof Lifecycle ? (Lifecycle) resources.getSource() : null) { @Override public void afterUnbind() { afterUnbindConsumer(destination, this.group, properties); destroyErrorInfrastructure(destination, group, properties); } }; }