2017-11-10 5 views
0

메시지 채널을 보내는 동안 메시지 채널에서 예외가 발생합니다. 누구든지 도와주세요. 에 의한Spring 통합 헤더 값 라우터 라우터

예외 :

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> 

감사합니다.

답변

0

구성에 문제가 있거나 구성이 잘못되어 표시되지 않습니다.

// 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 해상도로 폴백 (fallback) :

AbstractMappingMessageRouter

는 논리를 가지고있다.

은 확실히 당신은 당신의 샘플에 있습니다

<int:mapping value="ZCRMXIF_PRODUCT_MATERIAL" channel="ZCRMMATMAS" /> 

그래서, 그

은 아마 value="ZCRMXIF_PRODUCT_MATERIAL"singletonMap("IDOCTYP","ZCRMXIF_PRODUCT_MATERIAL") 헤더 정의의 일부 호환되지 않는 기호가 ... 어떤 문제가 있는지 명확하지 않다. ..