HelloWorldDemo now uses a BeanFactoryChannelResolver (instead of ChannelRegistry).

This commit is contained in:
Mark Fisher
2008-10-13 01:41:48 +00:00
parent a8d25f6171
commit 82ce1373ac
2 changed files with 7 additions and 6 deletions

View File

@@ -18,10 +18,10 @@ package org.springframework.integration.samples.helloworld;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.BeanFactoryChannelResolver;
import org.springframework.integration.channel.ChannelResolver;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.config.xml.MessageBusParser;
import org.springframework.integration.message.StringMessage;
/**
@@ -33,11 +33,11 @@ public class HelloWorldDemo {
public static void main(String[] args) {
AbstractApplicationContext context = new ClassPathXmlApplicationContext("helloWorldDemo.xml", HelloWorldDemo.class);
ChannelRegistry channelRegistry = (ChannelRegistry) context.getBean(MessageBusParser.MESSAGE_BUS_BEAN_NAME);
MessageChannel inputChannel = channelRegistry.lookupChannel("inputChannel");
PollableChannel outputChannel = (PollableChannel) channelRegistry.lookupChannel("outputChannel");
ChannelResolver channelResolver = new BeanFactoryChannelResolver(context);
MessageChannel inputChannel = channelResolver.resolveChannelName("inputChannel");
PollableChannel outputChannel = (PollableChannel) channelResolver.resolveChannelName("outputChannel");
inputChannel.send(new StringMessage("World"));
System.out.println(outputChannel.receive().getPayload());
System.out.println(outputChannel.receive(0).getPayload());
context.stop();
}

View File

@@ -10,6 +10,7 @@
<message-bus/>
<channel id="inputChannel"/>
<channel id="outputChannel">
<queue capacity="10"/>
</channel>