[
https://issues.apache.org/jira/browse/CAMEL-10910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tomohisa Igarashi updated CAMEL-10910:
--------------------------------------
Description:
I noticed that if eventDrivenProcessors contains only one processor, IN message
is not copied to OUT even when exchange pattern is InOut while it does if it
contains multiple processors.
eventDrivenProcessors are wrapped with Pipeline here when initiating a camel
route here:
https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java#L161
But if there's only one event driven processor, the processor itself is used
instead of wrapping with Pipeline:
https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java#L57
Pipeline copies the IN message to OUT if it's InOut and OUT message doesn't
exist:
https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java#L107
So the IN->OUT copy happens only if multiple processors exist. It means that
whether the response message is returned as OUT or IN depends on if the route
results in single processor or not. I think it looks a bit confusing and
wondering if we can just wrap it with the Pipleline even if there's single
processor.
Having said that as this has been same for 10 years, we can't change this
behavior in 2.x as it would break backward compatibility. Let's revisit in 3.0.
was:
I noticed that if eventDrivenProcessors contains only one processor, IN message
is not copied to OUT even when exchange pattern is InOut while it does if it
contains multiple processors.
eventDrivenProcessors are wrapped with Pipeline here when initiating a camel
route here:
https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java#L161
But if there's only one event driven processor, the processor itself is used
instead of wrapping with Pipeline:
https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java#L57
Pipeline copies the IN message to OUT if it's InOut and OUT message doesn't
exist:
https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java#L107
So the IN->OUT copy happens only if multiple processors exist. It means that
whether the response message is returned as OUT or IN depends on if the route
results in single processor or not. I think it looks a bit confusing and
wondering if we can just wrap it with the Pipleline even if there's single
processor.
Having said that this has been same for 10 years, we can't change this behavior
in 2.x as it would break backward compatibility. Let's revisit in 3.0.
> Revisit if Pipeline should wrap single processor or not
> -------------------------------------------------------
>
> Key: CAMEL-10910
> URL: https://issues.apache.org/jira/browse/CAMEL-10910
> Project: Camel
> Issue Type: Task
> Components: camel-core
> Reporter: Tomohisa Igarashi
> Assignee: Tomohisa Igarashi
> Fix For: 3.0.0
>
>
> I noticed that if eventDrivenProcessors contains only one processor, IN
> message is not copied to OUT even when exchange pattern is InOut while it
> does if it contains multiple processors.
> eventDrivenProcessors are wrapped with Pipeline here when initiating a camel
> route here:
> https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java#L161
> But if there's only one event driven processor, the processor itself is used
> instead of wrapping with Pipeline:
> https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java#L57
> Pipeline copies the IN message to OUT if it's InOut and OUT message doesn't
> exist:
> https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java#L107
> So the IN->OUT copy happens only if multiple processors exist. It means that
> whether the response message is returned as OUT or IN depends on if the route
> results in single processor or not. I think it looks a bit confusing and
> wondering if we can just wrap it with the Pipleline even if there's single
> processor.
> Having said that as this has been same for 10 years, we can't change this
> behavior in 2.x as it would break backward compatibility. Let's revisit in
> 3.0.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)