SimpleEndpoint provides the ChannelRegistry reference to its handler if that handler implements ChannelRegistryAware.

This commit is contained in:
Mark Fisher
2008-08-11 14:09:57 +00:00
parent a22ba13809
commit e6c63cfb0b

View File

@@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.ChannelRegistryAware;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.handler.MessageHandler;
import org.springframework.integration.message.CompositeMessage;
@@ -120,6 +121,9 @@ public class SimpleEndpoint<T extends MessageHandler> implements MessageTarget,
}
public void setChannelRegistry(ChannelRegistry channelRegistry) {
if (this.handler instanceof ChannelRegistryAware) {
((ChannelRegistryAware) this.handler).setChannelRegistry(channelRegistry);
}
this.channelRegistry = channelRegistry;
}