Exchange.getIn().getBody() returns empty string in camel on second call

前端 未结 1 1269
说谎
说谎 2020-12-18 04:48

I have 2 identical calls:

String msg1 = exchange.getIn().getBody(String.class);
String msg2 = exchange.getIn().getBody(String.class);

In ms

相关标签:
1条回答
  • 2020-12-18 05:12

    From http://camel.apache.org/jetty.html

    Jetty is stream based, which means the input it receives is submitted to Camel as a stream. That means you will only be able to read the content of the stream once.

    Just convert the input in a String before use it twice or more times

    <route id="route2">
        <from uri="jetty://http://localhost:8090" />
        <convertBodyTo type="String" />
        <process ref="messageProcessor" />
    </route>
    
    0 讨论(0)
提交回复
热议问题