[英]Spring Integration with header-value-router router
消息通道在發送消息時引發異常。請幫助我,任何人。
引起異常的原因:
org.springframework.messaging.MessagingException: failed to resolve channel name 'ZCRMXIF_PRODUCT_MATERIAL'; nested exception is org.springframework.messaging.core.DestinationResolutionException:
failed to look up MessageChannel with name 'ZCRMXIF_PRODUCT_MATERIAL' in the BeanFactory.;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ZCRMXIF_PRODUCT_MATERIAL' is defined.
代碼:
Map headers = Collections.singletonMap("IDOCTYP","ZCRMXIF_PRODUCT_MATERIAL");
idocXmlInboundChannel.send(new GenericMessage("message", headers));
彈簧配置
<int:channel id="idocXmlInboundChannel">
<int:interceptors>
<int:wire-tap channel="logger" />
</int:interceptors>
</int:channel>
<int:logging-channel-adapter log-full-message="true" id="logger" level="DEBUG" />
<bean id="idocInboundService" class="com.hybris.datahub.sapidocintegration.spring.HttpInboundService">
<property name="idocXmlInboundChannel" ref="idocXmlInboundChannel" />
</bean>
<!-- Data Hub input channel for raw data -->
<int:channel id="rawFragmentDataInputChannel" />
<!-- Maps received IDOCs by value of header attribute: "IDOCTYP" to corresponding mapping service -->
<int:header-value-router input-channel="idocXmlInboundChannel" header-name="IDOCTYP">
<int:mapping value="ZCRMXIF_PRODUCT_MATERIAL" channel="ZCRMMATMAS" />
</int:header-value-router>
<!-- sap crm product -->
<int:service-activator input-channel="ZCRMMATMAS" output-channel="rawFragmentDataInputChannel" ref="customproductCRMMappingService" method="map" />
<!-- Dummy implementations of mapping services implemented elsewhere -->
<bean id="customproductCRMMappingService" class="com.hybris.datahub.sapidocintegration.IDOCMappingService">
<property name="rawFragmentDataExtensionSource" value="customproduct" />
<property name="rawFragmentDataType" value="RawCustomProduct" />
</bean>
提前致謝。
您的配置有問題,或者您沒有完全顯示失敗的配置。
AbstractMappingMessageRouter
具有以下邏輯:
// if the channelMappings contains a mapping, we'll use the mapped value
// otherwise, the String-based channelKey itself will be used as the channel name
String channelName = channelKey;
boolean mapped = false;
if (this.channelMappings.containsKey(channelKey)) {
channelName = this.channelMappings.get(channelKey);
mapped = true;
}
if (this.prefix != null) {
channelName = this.prefix + channelName;
}
if (this.suffix != null) {
channelName = channelName + this.suffix;
}
MessageChannel channel = resolveChannelForName(channelName, message);
if (channel != null) {
channels.add(channel);
if (!mapped && !(this.dynamicChannels.get(channelName) != null)) {
this.dynamicChannels.put(channelName, channel);
}
}
因此,我們回退到正常value
分辨率只有在情況下,我們dont't有該值的映射。
您的樣本中肯定有它:
<int:mapping value="ZCRMXIF_PRODUCT_MATERIAL" channel="ZCRMMATMAS" />
所以,目前尚不清楚這是什么問題...
標頭定義中的value="ZCRMXIF_PRODUCT_MATERIAL"
和singletonMap("IDOCTYP","ZCRMXIF_PRODUCT_MATERIAL")
可能存在一些不兼容的符號...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.