简体   繁体   中英

Can I get multiple outputs using apache camel?

I am using apache camel route. In which I have written a socket having parameters as encoder and decoder of netty.

I am giving input as a string and I want to get two strings as output. Encoder and decoder are producing two outputs, But on the route, I am getting first output only not the second one.

Is there any way to get multiple outputs for a single input in apache camel route?

Here is my route:

<post uri="/testaddstring">
     <route id="testaddstring">
            <script>
               <groovy>
                  <![CDATA[
                    String originalFileContent =(String)exchange.getIn().getBody(String.class);
                                    exchange.getIn().setBody(originalFileContent)
                                    System.out.println("in test add");
                                ]]>
                                </groovy>
                            </script>
                             <to uri="netty4:tcp://localhost:5030?sync=true&amp;encoder=#i8583Encoder&amp;decoder=#i8583Decoder"/> 
                        </route>
                    </post>

Socket:

<route id="i8583SocketService">
    <from
        uri="netty4:tcp://localhost:5030?sync=true&amp;encoder=#iEncoder&amp;decoder=#iDecoder" />
    <to
        uri="log:i8583SocketService?level=INFO&amp;showAll=true&amp;multiline=true" />      
</route>

我不完全理解您的问题,但是,如果您骆驼路线发送1条消息 ,并且希望从中获得2条消息,则通常必须使用Splitter EIP ,将您的原始消息分为多个部分并将这些部分作为个别讯息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM