Split MessageSource types into 2 sub-interfaces: PollableSource and SubscribableSource. The MessageChannel hierarchy has also been revised accordingly. DirectChannel and PublishSubscribeChannel are now SubscribableSources, while the other queue-based channels are PollableSources. The PollableChannel interface extends BlockingSource which in turn is an extension of PollableSource that adds timeout-aware methods.
This commit is contained in:
@@ -20,6 +20,7 @@ import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.channel.ChannelRegistry;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.channel.PollableChannel;
|
||||
import org.springframework.integration.config.MessageBusParser;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
|
||||
@@ -34,7 +35,7 @@ public class HelloWorldDemo {
|
||||
AbstractApplicationContext context = new ClassPathXmlApplicationContext("helloWorldDemo.xml", HelloWorldDemo.class);
|
||||
ChannelRegistry channelRegistry = (ChannelRegistry) context.getBean(MessageBusParser.MESSAGE_BUS_BEAN_NAME);
|
||||
MessageChannel inputChannel = channelRegistry.lookupChannel("inputChannel");
|
||||
MessageChannel outputChannel = channelRegistry.lookupChannel("outputChannel");
|
||||
PollableChannel outputChannel = (PollableChannel) channelRegistry.lookupChannel("outputChannel");
|
||||
inputChannel.send(new StringMessage("World"));
|
||||
System.out.println(outputChannel.receive().getPayload());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user