Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/371.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java dispatcher没有订阅服务器-spring集成JMS_Java_Jms_Spring Integration - Fatal编程技术网

Java dispatcher没有订阅服务器-spring集成JMS

Java dispatcher没有订阅服务器-spring集成JMS,java,jms,spring-integration,Java,Jms,Spring Integration,我想将JMS添加到现有的spring集成项目中。我要更改的xml文件如下所示: <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns="http://www.springframework

我想将JMS添加到现有的spring集成项目中。我要更改的xml文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" 
   xmlns="http://www.springframework.org/schema/integration"
xmlns:jms="http://www.springframework.org/schema/integration/jms"
xmlns:int-http="http://www.springframework.org/schema/integration/http" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
    http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
    http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http.xsd
    http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">

<channel id="eventUpdateChannel" />

<chain input-channel="eventUpdateChannel" output-channel="eventUpdateChannelRouter">
(...)
</chain>
(...)
</bean>
我还添加了这一部分:

<!-- JMS -->
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
    <property name="targetConnectionFactory">
        <bean class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="vm://localhost"/>
        </bean>
    </property>
    <property name="sessionCacheSize" value="10"/>
    <property name="cacheProducers" value="false"/>
</bean>

<bean id="inboundMessageQueue" class="org.apache.activemq.command.ActiveMQQueue">
    <constructor-arg value="queue.request"/>
</bean>

您的适配器正在将其数据发送到不再订阅任何内容的
eventUpdateChannel

以前,订阅了

根据您在下面的评论,您需要

<channel id="eventUpdateChannel" />

<jms:outbound-channel-adapter id="jmsOut" channel="eventUpdateChannel" destination="inboundMessageQueue"/>

<jms:message-driven-channel-adapter id="jmsIn" destination="inboundMessageQueue"   channel="jmsEventUpdateChannel" />

<channel id="jmsEventUpdateChannel" />

<chain input-channel="jmsEventUpdateChannel" output-channel="eventUpdateChannelRouter">


如果您所做的只是使用JMS进行持久化,那么您可以删除适配器,只需将
eventUpdateChannel
设置为JMS支持的通道。如果您使用它将工作分发给其他JVM,那么适配器是正确的选择。

感谢您的反馈。现在不应该订阅
jms:message-driven通道适配器吗?如果不是像我所做的那样,我应该如何将jms连接到该通道;消息驱动适配器是生产者;没有使用者(订户)。我不知道你到底想做什么,所以我不能猜测。您当前有两个订阅服务器订阅
jmsEventUpdateChannel
——链和出站适配器。我希望来自
eventUpdateChannel
的消息转到jms队列,并从该队列转到链。如果出站适配器连接到
eventUpdateChannel
,然后消息驱动适配器连接到
jmsEventUpdateChannel
,则工作正常,感谢您的帮助。我接受你的答案,我会给+1,但我没有足够的代表
org.springframework.integration.MessageDeliveryException: Dispatcher has no subscribers for channel eventUpdateChannel.
<channel id="eventUpdateChannel" />

<jms:outbound-channel-adapter id="jmsOut" channel="eventUpdateChannel" destination="inboundMessageQueue"/>

<jms:message-driven-channel-adapter id="jmsIn" destination="inboundMessageQueue"   channel="jmsEventUpdateChannel" />

<channel id="jmsEventUpdateChannel" />

<chain input-channel="jmsEventUpdateChannel" output-channel="eventUpdateChannelRouter">