reordered ctor args, handler comes first since handleMessage() is still the primary responsibility
This commit is contained in:
@@ -101,15 +101,14 @@ public class ConsumerEndpointFactoryBean
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
/*
|
||||
* Will check if this.handler needs to be wrapped in MessageHistoryAwareMessageHandler.
|
||||
* Such wrapping is only required if this.beanFactory contains bean of type MessageHistoryWriter.class
|
||||
*/
|
||||
Map<String, MessageHistoryWriter> historyWriters = BeanFactoryUtils.beansOfTypeIncludingAncestors((ListableBeanFactory)this.beanFactory, MessageHistoryWriter.class);
|
||||
if (historyWriters.size() == 1){
|
||||
// Will check if this.handler needs to be wrapped in a MessageHistoryAwareMessageHandler.
|
||||
// Such wrapping is only required if this.beanFactory contains a bean of type MessageHistoryWriter.
|
||||
Map<String, MessageHistoryWriter> historyWriters = BeanFactoryUtils.beansOfTypeIncludingAncestors(
|
||||
(ListableBeanFactory) this.beanFactory, MessageHistoryWriter.class);
|
||||
if (historyWriters.size() == 1) {
|
||||
MessageHistoryWriter writer = historyWriters.values().iterator().next();
|
||||
if (!beanName.startsWith("org.springframework") && this.handler instanceof IntegrationObjectSupport){
|
||||
this.handler = new MessageHistoryAwareMessageHandler(writer, this.beanName, this.handler);
|
||||
if (!this.beanName.startsWith("org.springframework") && this.handler instanceof IntegrationObjectSupport) {
|
||||
this.handler = new MessageHistoryAwareMessageHandler(this.handler, writer, this.beanName);
|
||||
}
|
||||
}
|
||||
this.initializeEndpoint();
|
||||
|
||||
@@ -33,11 +33,11 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class MessageHistoryAwareMessageHandler implements NamedComponent, MessageHandler, Ordered {
|
||||
|
||||
private MessageHandler targetHandler;
|
||||
private final MessageHandler targetHandler;
|
||||
|
||||
private String componentName;
|
||||
private final MessageHistoryWriter historyWriter;
|
||||
|
||||
private MessageHistoryWriter historyWriter;
|
||||
private final String componentName;
|
||||
|
||||
|
||||
/**
|
||||
@@ -45,12 +45,12 @@ public class MessageHistoryAwareMessageHandler implements NamedComponent, Messag
|
||||
* @param endpointName
|
||||
* @param targetHandler
|
||||
*/
|
||||
public MessageHistoryAwareMessageHandler(MessageHistoryWriter historyWriter, String endpointName, MessageHandler targetHandler) {
|
||||
public MessageHistoryAwareMessageHandler(MessageHandler targetHandler, MessageHistoryWriter historyWriter, String endpointName) {
|
||||
Assert.notNull(targetHandler, "targetHandler must not be null");
|
||||
Assert.notNull(historyWriter, "historyWriter must not be null");
|
||||
this.targetHandler = targetHandler;
|
||||
this.historyWriter = historyWriter;
|
||||
this.componentName = endpointName;
|
||||
this.targetHandler = targetHandler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user