java - Spring 集成:Dispatcher 没有频道订阅者
问题描述
我正在尝试构建一个 spring 集成应用程序,它具有以下配置(罪魁祸首似乎是通道xsltSpecific
):
<beans:beans>
<channel id="channel1"></channel>
<channel id="channel2"></channel>
<channel id="xsltSpecific"></channel>
<channel id="xsltSpecificDelayed"></channel>
<channel id="xsltCommon"></channel>
<channel id="irdSpecificUnmarshallerChannel"></channel>
<channel id="irdSpecificInputChannel"></channel>
<file:outbound-channel-adapter
directory="${dml.ird.directory}" channel="channel1"
auto-create-directory="true" filename-generator="timestampedFileNameGenerator">
</file:outbound-channel-adapter>
<recipient-list-router input-channel="fileChannel">
<recipient channel="channel1" selector-expression="${dml.data.logs.enable}" />
<recipient channel="channel2" />
</recipient-list-router>
<recipient-list-router input-channel="channel2">
<recipient channel="xsltSpecificDelayed"></recipient>
<recipient channel="xsltCommon"></recipient>
</recipient-list-router>
<delayer id="specificDelayer" input-channel="xsltSpecificDelayed" default-delay="5000" output-channel="xsltSpecific"/>
<jms:message-driven-channel-adapter
id="jmsInboundAdapterIrd" destination="jmsInputQueue" channel="fileChannel"
acknowledge="transacted" transaction-manager="transactionManager"
error-channel="errorChannel" client-id="${ibm.jms.connection.factory.client.id}"
subscription-durable="true" durable-subscription-name="${ibm.jms.subscription.id1}" />
<si-xml:xslt-transformer input-channel="xsltCommon" output-channel="jmsInputChannel"
xsl-resource="classpath:summit-hub-to-cpm-mapping.xsl" result-transformer="resultTransformer" >
</si-xml:xslt-transformer>
<si-xml:xslt-transformer input-channel="xsltSpecific" output-channel="irdSpecificUnmarshallerChannel"
xsl-resource="classpath:summit-hub-specific.xsl" result-transformer="resultTransformer" >
</si-xml:xslt-transformer>
<si-xml:unmarshalling-transformer id="irdUnmarshaller"
unmarshaller="irdUnmarshallerDelegate" input-channel="irdSpecificUnmarshallerChannel"
output-channel="saveSpecificTradeChannel" />
<beans:bean id="irdUnmarshallerDelegate"
class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<beans:property name="schema"
value="summit-hub-specific.xsd" />
<beans:property name="contextPath"
value="com.h.i.c.d.i.mapping" />
</beans:bean>
<beans:bean id="resultTransformer" class="org.springframework.integration.xml.transformer.ResultToStringTransformer" />
<service-activator ref="specificTradeService" input-channel="saveSpecificTradeChannel"
requires-reply="false" method="save"/>
<file:inbound-channel-adapter directory="${dml.retry.directoryForIrd}"
channel="fileChannelAfterRetry" auto-create-directory="true"
prevent-duplicates="false" filename-regex=".*\.(msg|xml)" queue-size="50" >
<poller fixed-delay="${dml.retry.delay}" max-messages-per-poll="50">
<transactional transaction-manager="transactionManager" />
</poller>
</file:inbound-channel-adapter>
<channel id="fileChannel"/>
<channel id="fileChannelAfterRetry"/>
<file:file-to-string-transformer
input-channel="fileChannelAfterRetry" output-channel="fileChannel"
delete-files="true" />
<beans:import resource="classpath:cpm-dml-common-main.xml" />
</beans:beans>
但我有以下例外:
org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'org.springframework.context.support.GenericApplicationContext@6950e31.xsltSpecific'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers
这个例外是什么意思?另外,我无法发现问题,您能帮我解决这个问题吗?
更新
抱歉,我之前没有给出整个上下文,因为我认为它不相关。在从 派生的测试期间出现异常,该测试在测试AbstractTransactionalJUnit4SpringContextTests
结束时关闭应用程序上下文,在消息有机会到达结束之前。我Thread.sleep(10000)
在测试结束时添加了一个,异常不再发生。
解决方案
这xsltSpecific
只是将消息传递给频道订阅者的默认DirectChannel
设置。UnicastingDispatcher
根据您的配置,您从以下渠道向该频道发送消息:
<delayer id="specificDelayer" input-channel="xsltSpecificDelayed" default-delay="5000" output-channel="xsltSpecific"/>
而且看起来你真的有这个频道的订阅者:
<si-xml:xslt-transformer input-channel="xsltSpecific" output-channel="irdSpecificUnmarshallerChannel"
xsl-resource="classpath:summit-hub-specific.xsl" result-transformer="resultTransformer" >
</si-xml:xslt-transformer>
当这个定义的订阅者丢失时,真正不清楚的是什么。看起来你auto-startup="false"
在这个端点上没有一个,但另一方面,也许你真的在运行时停止它......
你介意分享更多关于这个问题的堆栈跟踪吗?我想看看谁是丢失消息的原始呼叫者。
推荐阅读
- pandas - 将 pandas 中的字符串字符 (') 替换为 (-) 并将其更改为 datetime
- flutter - 选择列表行的按钮
- python - 我想将具有多个值的列拆分为一个
- javascript - 如何在 next.js 中发送带有本地资产图像的 https 请求?
- c# - 如何将 C++ 字符串从 C++dll 返回到 C# 应用程序
- javascript - 在 vanilla JS Web 应用程序中使用 Kotlin 多平台库
- pytorch - cuDNN 中的等效 AdaptiveAvgPool2d API
- visual-studio-code - 扩展主机意外终止 vscode mac
- apache-spark - 使用复杂过滤器连接两个 spark 数据集 spark java
- php - 最近下载的 WordPress 5.7.2 但在 localhost 上运行时获取错误