重新发送到Kafka主题时,骆驼中的无限循环

我们将消息发送到Kafka主题,然后通过骆驼路由发送到ActiveMQ主题,一切都如预期的那样进行。但是现在,我们有了另一条路由,将消息Arrivive从ActiveMQ主题发送到Kafka的另一个主题,这就是Camel进入无限循环的位置。这是我的路线XML。为什么这种类型的配置会导致无限循环?


<!--DEFINE KAFKA'S TOPCIS AS ENDPOINT-->

            <endpoint id="tagBlink" uri="kafka:10.0.0.165:9092">

                <property key="topic" value="tagBlink"/>

                <property key="brokers" value="10.0.0.165:9092"/>

            </endpoint>

        <!--END OF KAFKA'S TOPICS's AS ENDPOINT-->


            <endpoint id="testMike" uri="kafka:10.0.0.165:9092">

                <property key="topic" value="testMike"/>

                <property key="brokers" value="10.0.0.165:9092"/>

            </endpoint>


         <!-- Route from Kafka (otherMessage) to ActiveMQ (wherenet.flow.deliveryNotificationProducer)-->

        <route id="route1">

            <from uri="ref:tagBlink"/>

                <!--<process ref="transformToXML" />-->

            <to uri="activemq:topic:myTopic"/>            

            <log message="Routing message from Kafka"/>

        </route>



        <route id="routeAutoGeneratedAMQ">  

            <from uri="activemq:topic:myTopic" />                   

            <to uri="ref:testMike"/>

            <to uri="stream:out" />

        </route>


幕布斯6054654
浏览 117回答 1
1回答

皈依舞

好了,经过一些测试,我在Camel Configuration中读取了此参数bridgeEndpoint&nbsp; Default:false&nbsp; &nbsp;Camel 2.16.0: If bridgeEndpoint is true, the producer will ignore the topic header setting of the message.因此,我尝试添加到我的终点&nbsp; &nbsp; &nbsp; &nbsp; <!--DEFINE KAFKA'S TOPCIS AS ENDPOINT-->&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <endpoint id="tagBlink" uri="kafka:10.0.0.165:9092">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <property key="topic" value="tagBlink"/><property key="topic" value="tagBlink"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <property key="brokers" value="10.0.0.165:9092"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <property key="bridgeEndpoint " value="true"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </endpoint>&nbsp; &nbsp; &nbsp; &nbsp; <!--END OF KAFKA'S TOPICS's AS ENDPOINT-->&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <endpoint id="testMike" uri="kafka:10.0.0.165:9092">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <property key="topic" value="testMike"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<property key="brokers" value="10.0.0.165:9092"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <property key="bridgeEndpoint " value="true"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </endpoint>并且无限循环停止了。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java