Apache Camel Route Multicast不会复制交换消息

时间:2015-01-27 12:22:52

标签: copy apache-camel multicast

我使用camel route在我的应用程序中制作了spring dsl。我想使用exchange body EIP复制multicast。但是当我使用它时,我可以使用来自我exchange body之一的endpoint。在第二个(多播中的端点)中,交换体是null。为什么会这样发生?

修改 这是我的路线:

<route errorHandlerRef="dlc1" id="mobitRoute1">

            <from uri="cxf:bean:mobit-okuma?dataFormat=PAYLOAD" />
            <wireTap uri="activemq:queue:anaMobitQueue" />
            <to uri="velocity:response.vm" />

        </route>

        <route id="mobitRoute2" errorHandlerRef="dlc2">

            <from uri="activemq:queue:anaMobitQueue" />
            <unmarshal ref="myJaxb" />
            <to uri="bean:timeChanging" />
            <multicast>

                <to uri="activemq:queue:mobitOkumaq" />
                <to uri="activemq:queue:AysMobit" />

            </multicast>
        </route>

        <route errorHandlerRef="dlc3" id="mobitRoute3">

            <from uri="activemq:queue:AysMobit" />
            <!-- <unmarshal ref="myJaxb" /> -->
            <to uri="bean:fromPayload" />
            <to uri="cxf:bean:ays-service?dataFormat=POJO" />

        </route>

        <route errorHandlerRef="dlc4" id="mobitRoute4">

            <from uri="activemq:queue:mobitOkumaq" />
            <to uri="cxf:bean:mobit-okumaReal?dataFormat=POJO" />

        </route>

1 个答案:

答案 0 :(得分:0)

当我将交换放入队列时,我通过转换xml找到了解决方案。这就是为什么?我不知道。

<route errorHandlerRef="dlc1" id="mobitRoute1">

            <from uri="cxf:bean:mobit-okuma?dataFormat=PAYLOAD" />

            <wireTap uri="activemq:queue:anaMobitQueue" />
            <to uri="velocity:response.vm" />

        </route>

        <route errorHandlerRef="dlc1" id="mobitRoute2">
            <from uri="activemq:queue:anaMobitQueue" />

            <camel:pipeline>
                <unmarshal ref="myJaxb" />
                <to uri="bean:timeChanging" />
                <!-- <to uri="direct:unmarshalled"/> -->
                <marshal ref="myJaxb" />
                <camel:multicast>

                    <to uri="activemq:queue:BegisMobit" />
                    <to uri="activemq:queue:AysMobit" />

                </camel:multicast>
            </camel:pipeline>

        </route>



        <route errorHandlerRef="dlc2" id="mobitRoute3">

            <from uri="activemq:queue:AysMobit" />
            <unmarshal ref="myJaxb" />
            <to uri="bean:fromPayload" />
            <to uri="cxf:bean:ays-service?dataFormat=POJO" />

        </route>

        <route errorHandlerRef="dlc3" id="mobitRoute4">

            <from uri="activemq:queue:BegisMobit" />
            <unmarshal ref="myJaxb" />
            <to uri="cxf:bean:mobit-okumaReal?dataFormat=POJO" />

        </route>