[ 
https://issues.apache.org/jira/browse/CAMEL-20866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17854657#comment-17854657
 ] 

Claus Ibsen commented on CAMEL-20866:
-------------------------------------

Okay so this is a bit expected as the input is an input stream, and when you 
make seda InOnly it makes a shallow copy of the message; which means the body 
is the same object instance, and then you can have concurrent read from this in 
both routes.

So if I loop 100 times, then I get this sometimes
{code:java}
x1
x2
xx3
xx4
x5
x6
xx7
xx8
xx9
x10
x11
xx12
x13
xx14
x15
x16
x17
x18
x19
x20
x21
x22
xx23
x24
xx25
x26
xx27
xx28
x29
x30
x31
x32
x33
x34
x35
x36
x37
x38
x39
xx40
x41
x42
x43
x44
x45
x46
x47
x48
x49
x50
x51
xxx52
xx53
x54
x55
x56
x57
x58
x59
x60
x61
x62
x63
x64
x65
x66
x67
x68
x69
x70
x71
xx72
x73
x74
x75
x76
x77
x78
x79
x80
x81
x82
x83
x84
x85
x86
x87
x88
x89
x90
x91
x92
x93
x94
x95
x96
x97
x98
x99
x100
 {code}

> 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)

Reply via email to