[ https://issues.apache.org/jira/browse/CAMEL-20866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17854659#comment-17854659 ]
Claus Ibsen commented on CAMEL-20866: ------------------------------------- We could consider letting Camel copy the message body as a new StreamCache body when its StreamCaching based. Then you would have individual objects and this will avoid this problem with concurrent read on the same instance. The overhead is that the payload is then also copied (ie in-memory buffer) and that its in camel-core so a central place in the routing engine. > SEDA with exchangepattern InOnly gives sometimes multiple responses > ------------------------------------------------------------------- > > Key: CAMEL-20866 > URL: https://issues.apache.org/jira/browse/CAMEL-20866 > Project: Camel > Issue Type: Bug > Components: camel-seda > Affects Versions: 4.6.0 > Reporter: Raymond > Priority: Minor > Attachments: main-xml.zip > > > I have Camel 4.6 running on Java 21 > When I use the following curl: > {code:java} > curl -X POST --header "Content-Type: text/plain" --data 'x' > http://localhost:9001/test{code} > To test the following route: > {code:java} > <routes id="camel" xmlns="http://camel.apache.org/schema/spring"> > <route id="1"> > <from uri="jetty:http://0.0.0.0:9001/test"/> > <to uri="seda:2?exchangePattern=InOut"/> > </route> > <route id="2"> > <from uri="seda:2"/> > <setBody> > <constant>Y</constant> > </setBody> > </route> > </routes>{code} > This works as expected and the result is Y. > Now I changed the exchangepattern from 'InOut' to 'InOnly': > {code:java} > <routes id="camel" xmlns="http://camel.apache.org/schema/spring"> > <route id="1"> > <from uri="jetty:http://0.0.0.0:9001/test"/> > <to uri="seda:2?exchangePattern=InOnly"/> > </route> > <route id="2"> > <from uri="seda:2"/> > <setBody> > <constant>Y</constant> > </setBody> > </route> > </routes>{code} > When I call this flow with curl multiple times, I sometimes get the result: > X > And the other time: > XX > So the result is returned twice or even more times. I would expect only to > get the output X (which for example works this way when I use ActiveMQ). > It may take more than 10 times before you can see the double responses, but > this behavior can be easier reproduced by adding more SEDA endpoints: > {code:java} > <routes id="camel" xmlns="http://camel.apache.org/schema/spring"> <route > id="1"> <from uri="jetty:http://0.0.0.0:9001/test"/> <to > uri="seda:2?exchangePattern=InOnly"/> </route> <route id="2"> <from > uri="seda:2"/> <to uri="seda:3"/> </route> <route id="3"> <from > uri="seda:3"/> <to uri="seda:4"/> </route> <route id="4"> <from > uri="seda:4"/> <to uri="seda:5"/> </route> <route id="5"> <from > uri="seda:5"/> <setBody> <constant>Y</constant> </setBody> > </route></routes>{code} -- This message was sent by Atlassian Jira (v8.20.10#820010)