[ 
https://issues.apache.org/jira/browse/CAMEL-20866?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Raymond updated CAMEL-20866:
----------------------------
    Description: 
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}

  was:
I have Camel 4.6 running on Java 21

When I use the following curl:

```
curl -X POST --header "Content-Type: text/plain" --data 'x' 
http://localhost:9001/test
```

To test the following route:



```xml
<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>
```

This works as expected and the result is Y.

Now I changed the exchangepattern from 'InOut' to 'InOnly':


```xml
<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>
```

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)

By adding more SEDA endpoints this behavior can be easier reproduced:

```xml
{color:#e8bf6a}<routes {color}{color:#bababa}id{color}{color:#6a8759}="camel" 
{color}{color:#bababa}xmlns{color}{color:#6a8759}="http://camel.apache.org/schema/spring"{color}{color:#e8bf6a}>
{color}{color:#e8bf6a} <route 
{color}{color:#bababa}id{color}{color:#6a8759}="1"{color}{color:#e8bf6a}>
{color}{color:#e8bf6a} <from 
{color}{color:#bababa}uri{color}{color:#6a8759}="jetty:http://0.0.0.0:9001/test"{color}{color:#e8bf6a}/>
{color}{color:#e8bf6a} <to 
{color}{color:#bababa}uri{color}{color:#6a8759}="seda:2?exchangePattern=InOnly"{color}{color:#e8bf6a}/>
{color}{color:#e8bf6a} </route>
{color}{color:#e8bf6a} <route 
{color}{color:#bababa}id{color}{color:#6a8759}="2"{color}{color:#e8bf6a}>
{color}{color:#e8bf6a} <from 
{color}{color:#bababa}uri{color}{color:#6a8759}="seda:2"{color}{color:#e8bf6a}/>
{color}{color:#e8bf6a} <to 
{color}{color:#bababa}uri{color}{color:#6a8759}="seda:3"{color}{color:#e8bf6a}/>
{color}{color:#e8bf6a} </route>
{color}{color:#e8bf6a} <route 
{color}{color:#bababa}id{color}{color:#6a8759}="3"{color}{color:#e8bf6a}>
{color}{color:#e8bf6a} <from 
{color}{color:#bababa}uri{color}{color:#6a8759}="seda:3"{color}{color:#e8bf6a}/>
{color}{color:#e8bf6a} <to 
{color}{color:#bababa}uri{color}{color:#6a8759}="seda:4"{color}{color:#e8bf6a}/>
{color}{color:#e8bf6a} </route>
{color}{color:#e8bf6a} <route 
{color}{color:#bababa}id{color}{color:#6a8759}="4"{color}{color:#e8bf6a}>
{color}{color:#e8bf6a} <from 
{color}{color:#bababa}uri{color}{color:#6a8759}="seda:4"{color}{color:#e8bf6a}/>
{color}{color:#e8bf6a} <to 
{color}{color:#bababa}uri{color}{color:#6a8759}="seda:5"{color}{color:#e8bf6a}/>
{color}{color:#e8bf6a} </route>
{color}{color:#e8bf6a} <route 
{color}{color:#bababa}id{color}{color:#6a8759}="5"{color}{color:#e8bf6a}>
{color}{color:#e8bf6a} <from 
{color}{color:#bababa}uri{color}{color:#6a8759}="seda:5"{color}{color:#e8bf6a}/>
{color}{color:#e8bf6a} <setBody>
{color}{color:#e8bf6a} <constant>{color}Y{color:#e8bf6a}</constant>
{color}{color:#e8bf6a} </setBody>
{color}{color:#e8bf6a} </route>
{color}{color:#e8bf6a}
{color}{color:#e8bf6a}</routes>{color}
```


> 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: Major
>         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