目前我们在我们的应用程序中使用Spring Integration 2.1.0 Release。 申请流程如下:
显示如下错误:
[task-scheduler-5] 2017-10-05 18:32:20,732 ERROR org.springframework.integration.handler.LoggingHandler - org.springframework.integration.MessageDeliveryException: Dispatcher has no subscribers.
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:108)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:101)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:61)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
代码如下
<context:property-placeholder />
<!-- Gateway and connection factory setting -->
<int:channel id="telnetLandingChannel" />
<int:channel id="telnetReplyChannel" />
<beans:bean id="clientCustomSerializer"
class="com.telnet.core.serializer.CustomSerializer">
<beans:property name="terminatingChar" value="10" />
<beans:property name="maxLength" value="65535" />
</beans:bean>
<int:gateway id="gw" default-reply-channel="telnetReplyChannel" default-reply-timeout="100000"
service-interface="com.telnet.core.integration.connection.ParseTcpConfiguration$SimpleGateway"
default-request-channel="telnetLandingChannel"/>
<ip:tcp-connection-factory id="clientFactory"
type="client" host="localhost" port="7777" single-use="false" using-nio="false"
serializer="${client.serializer}" deserializer="${client.serializer}" />
<ip:tcp-outbound-gateway id="clientInGw"
request-channel="telnetLandingChannel"
connection-factory="clientFactory"
reply-channel="telnetReplyChannel"
reply-timeout="100000"/>
<!-- To send the messege over server via JMS and serviceActivator -->
<int:channel id="incidentDispatchMessageChannel" />
<int:channel id="jmsChannel" />
<beans:bean id="customClientServiceActivator"
class= "com.telnet.core.integration.CustomClientServiceActivator">
</beans:bean>
<int-jms:message-driven-channel-adapter id="incidentDispatchMessageChannelAdapter" error-channel="errorChannel"
connection-factory="mqConnectionFactory"
destination-name="${incident.processing.messaging.dispatch.queues}"
channel="incidentDispatchMessageChannel"/>
<int:service-activator id="incidentMessageActivator"
input-channel="incidentDispatchMessageChannel"
output-channel="jmsChannel"
ref="customClientServiceActivator" method="getOutboundMessage">
</int:service-activator>
<int:object-to-string-transformer id="clientBytes2String"
input-channel="jmsChannel"
output-channel="telnetLandingChannel"/>
<!-- To receive the acknowledgement message on server via serviceActivator -->
<int:service-activator id="incidentAck"
input-channel="telnetReplyChannel"
ref="customClientServiceActivator" method="getAck">
</int:service-activator>
我已经研究过有关stackverFlow的各种文章,但无法获得任何解决方案
答案 0 :(得分:0)
是的......这个错误并不清楚什么渠道是有罪的。
另一方面,你真的使用非常古老的Spring Integration版本。 很高兴考虑升级到最新版本:http://projects.spring.io/spring-integration/。
但是,我认为该问题与reply-channel
完全相同,您不仅可以使用<service-activator>
,还可以使用<int:gateway>
。
我建议您从网关定义中删除default-reply-channel="telnetReplyChannel"
,从reply-channel="telnetReplyChannel"
定义中删除<ip:tcp-outbound-gateway>
。并让他们在请求期间通过网关填充的replyChannel
标头进行通信。
关于导致相同<int-jms:message-driven-channel-adapter>
的{{1}}流量,我建议仍然保留<ip:tcp-outbound-gateway>
标题,但在此处通过replyChannel
填充它,然后再发送消息给<header-enricher>
telnetLandingChannel
。 replyChannel
通过<header-enricher>
input-channel
对于后续<int:service-activator>
处理来自<ip:tcp-outbound-gateway>
的确认而言只是req := q'{INSERT INTO CLIENTS(
IDEVT,
ID_CLIENT,
CATEGORIE_CLIENT,
SEGCO,
LIB_SEGCO,
NOM,RCS_ADRESSE,
CODE_POSTAL,
VILLE,
PAYS,
STATUT)
values( :1, :2, :3, :4, :5, :6
:7, :8, :9, :10)}';
execute immediate req
USING UNID , ID , SEGCO , L_SEGCO , LIB_SEGCO ,
NOM , ADRESSE , CODE_POSTAL , cVILLE , PAYS ;
。
答案 1 :(得分:0)
我得到了这个问题的解决方案,我们的代码中有多个xmls,但我已将代码添加到一个中以显示stackOverflow中的流程。 问题是我在xml中定义的,它只有配置部分,如出站适配器连接工厂,因为它应该在另一个我使用服务激活器的xml中定义。改变了频道定义的位置并且它有效。
我希望 在我收到响应消息的时候断开TCP(作为服务器)。 截至目前我正在使用so-timeout,所以我的TCP服务器将在so-timeout中给出的时间之后得到timedout,但要求是在TCP打印/显示确认的时刻断开连接。请建议我如何实现这一点。