Spring集成错误通道问题

Spring集成错误通道问题,spring,spring-integration,spring-kafka,mapr-streams,Spring,Spring Integration,Spring Kafka,Mapr Streams,我面临一个与maprstream的spring集成错误通道有关的问题 我已经创建了自己的错误通道,以便在正常流中发生任何异常时执行几个步骤。 但我不希望在sendMessageToMarstream流中出现任何异常时调用错误通道。因为我希望它作为一个单独的线程运行 <int:chain input-channel="errorChannel"> <int:transformer ref="transformExcep" method="transfor

我面临一个与maprstream的spring集成错误通道有关的问题

我已经创建了自己的错误通道,以便在正常流中发生任何异常时执行几个步骤。 但我不希望在sendMessageToMarstream流中出现任何异常时调用错误通道。因为我希望它作为一个单独的线程运行

     <int:chain input-channel="errorChannel">
        <int:transformer ref="transformExcep" method="transform"/>
        <int:service-activator ref="dosomeTask"/>
        <int:recipient-list-router>
                <int:recipient channel="sendMessageToMaprstream"/>
        </int:recipient-list-router>
    </int:chain>

    <task:executor id="executor" pool-size="10" />
    <int:publish-subscribe-channel id="sendMessageToMaprstream" task-executor="executor"/>      

    <int-kafka:outbound-channel-adapter 
       id="kafkaOutboundChannelAdapter"
       channel="sendMessageToMaprstream"
       kafka-template="template"
       topic="${maprstream.topicname}"
       message-key-expression="'exp'">                                 
   </int-kafka:outbound-channel-adapter>

在上述配置中,如果sendMessageToMarStream中存在任何异常,则错误通道将作为无限循环执行。 有人能帮我跳过sendMessageToMarstream中的错误吗

更新部分:

                 <int-kafka:outbound-channel-adapter 
                                id="kafkaOutboundChannelAdapter"
                                channel="sendMessageToMaprstream"
                                kafka-template="template"
                                topic="${maprstream.topicname}"
                                message-key-expression="'exp'"> 
                                    <int-kafka:request-handler-advice-chain>
                                      <bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
                                       <property name="failureChannel" ref="nullChannel"/>
                                       <property name="trapException" value="true"/>
                                      </bean>
                                   </int-kafka:request-handler-advice-chain>
                        </int-kafka:outbound-channel-adapter>

好吧,在没有至少一些日志的情况下接受异常是不好的

对于您的任务,您可以使用
expressionevaluationrequesthandleradvice
及其
failureChannel
trapException=true
选项:

<int-kafka:request-handler-advice-chain>
        <bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
            <property name="failureChannel" ref=" sendMessageToMaprstreamErrors"/>
        </bean>
            <property name="onFailureExpression" value="#root"/>
            <property name="trapException" value="true"/>
    </int-kafka:request-handler-advice-chain>


有关更多信息,请参阅。

非常感谢您提供解决方案的线索。请检查主问题中更新的部分,它似乎正在工作,它正在跳过无限循环。但我有一个关于failureChannel reference的问题。无论TrapeException值(真/假)如何,failureChannel似乎都无法执行。因为当我将TrapeException的值更改为true时,它跳过了异常。但当我将TrapeException的值更改为false时,它将进入连续循环。请你澄清一下好吗?请注意我使用了failureChannel的有效引用而不是nullChannel。是的。。。对不起,我错过了这个部分。如果没有
onFailureExpression
,则不会转到
failureChannel
。那里的
#root
表示
requestMessage
。感谢Artem,是的,现在当trapException==false时,它将进入参考通道。我尝试使用nullChannel作为输出通道,如下所述,我只是在这个处理程序中记录了异常,但似乎这个处理程序被无限调用。您能告诉我,一旦进入处理程序,如何停止此操作?