【发布时间】:2014-05-30 08:19:05
【问题描述】:
我正在尝试在 2 个应用程序之间进行通信:
在第一个应用程序中,我做了类似的事情并且没有错误地工作,它是否正常工作,我不知道。
public class Main {
public static void main(String[] args) {
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/new_tutorial.xml");
applicationContext.registerShutdownHook();
}
}
XML 配置:
<int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''">
<int:poller fixed-delay="60000" />
</int:inbound-channel-adapter>
<int:channel id="quakeinfo.channel">
<int:queue capacity="10"/>
</int:channel>
<int:channel id="quakeinfotrigger.channel" />
<int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''">
<int:poller fixed-delay="60000" />
</int:inbound-channel-adapter>
<int-ip:udp-outbound-channel-adapter id="metoo" channel="quakeinfotrigger.channel" port="11111" host="localhost"/>
<int:logging-channel-adapter id="messageLogger" log-full-message="true" channel="quakeinfo.channel" level="ERROR">
<int:poller fixed-delay="5000" />
</int:logging-channel-adapter>
在第二个应用程序中,我正在这样做:
public class InboundESB {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("/getinbound.xml");
}
}
在第二个应用程序的 xml 代码中:
<int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''">
<int:poller fixed-delay="60000" />
</int:inbound-channel-adapter>
<int:channel id="quakeinfotrigger.channel" />
<int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''">
<int:poller fixed-delay="60000" />
</int:inbound-channel-adapter>
<int-ip:udp-inbound-channel-adapter id="metoo" port="11111" channel="quakeinfotrigger.channel"/>
当我在第一个应用程序之后执行第二个应用程序时,它给了我一个错误:
org.springframework.integration.handler.LoggingHandler handleMessageInternal
SEVERE: org.springframework.integration.MessageDeliveryException: Dispatcher has no subscribers for channel quakeinfotrigger.channel.
我想将消息从 onr 应用程序传递到其他应用程序,但我是 Spring 集成的新手,所以我不知道该怎么做? 那么有什么帮助吗?
【问题讨论】:
标签: java spring-mvc spring-integration