You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Tomohisa Igarashi <tm...@gmail.com> on 2017/02/28 14:41:07 UTC

Pipeline for single processor - any side effect?

Hi,

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. Is there any undesirable side effect to doing that?

Thanks,
Tomo

Re: Pipeline for single processor - any side effect?

Posted by Tomohisa Igarashi <tm...@gmail.com>.
OK thanks, sounds like a plan - yep, as this has been same 10 years, changing this in 2.x would break backward compatibility, so it's fair enough to keep as is and revisit for 3.0 :)
https://issues.apache.org/jira/browse/CAMEL-10910

Thanks,
Tomo

On 02/28/2017 11:58 PM, Claus Ibsen wrote:
> Hi
>
> This is the behavior of 2.x and the EIPs and routing engine is
> optimized / doing this.
>
> We have already done too many changes IMHO in 2.19.x and should not do
> more changes for the sake of a change.
>
> Camel 3.0 allows to revisit the routing engine and exchange copy stuff
> that happens.
>
> You are welcome to log a JIRA for 3.0.
>
> On Tue, Feb 28, 2017 at 3:41 PM, Tomohisa Igarashi
> <tm...@gmail.com> wrote:
>> Hi,
>>
>> 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. Is there any undesirable side effect to doing that?
>>
>> Thanks,
>> Tomo
>
>
>

Re: Pipeline for single processor - any side effect?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

This is the behavior of 2.x and the EIPs and routing engine is
optimized / doing this.

We have already done too many changes IMHO in 2.19.x and should not do
more changes for the sake of a change.

Camel 3.0 allows to revisit the routing engine and exchange copy stuff
that happens.

You are welcome to log a JIRA for 3.0.

On Tue, Feb 28, 2017 at 3:41 PM, Tomohisa Igarashi
<tm...@gmail.com> wrote:
> Hi,
>
> 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. Is there any undesirable side effect to doing that?
>
> Thanks,
> Tomo



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2