Event Publisher Polishing

Now that the abstract binder makes its event publisher available to subclasses,
use it, if present, instead of the application context.
In most cases, they will be the same object, but the user might override the
publisher.

Resolves #336
This commit is contained in:
Gary Russell
2018-03-07 18:14:28 -05:00
committed by Oleg Zhurakousky
parent b5a0013e1e
commit 2406fe5237

View File

@@ -371,8 +371,14 @@ public class KafkaMessageChannelBinder extends
};
messageListenerContainer.setConcurrency(concurrency);
// these won't be needed if the container is made a bean
messageListenerContainer.setApplicationEventPublisher(getApplicationContext());
if (getApplicationEventPublisher() != null) {
messageListenerContainer.setApplicationEventPublisher(getApplicationEventPublisher());
}
else if (getApplicationContext() != null) {
messageListenerContainer.setApplicationEventPublisher(getApplicationContext());
}
messageListenerContainer.setBeanName(destination.getName() + ".container");
// end of these won't be needed...
if (!extendedConsumerProperties.getExtension().isAutoCommitOffset()) {
messageListenerContainer.getContainerProperties()
.setAckMode(AbstractMessageListenerContainer.AckMode.MANUAL);