You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Donald Whytock <dw...@gmail.com> on 2010/09/16 18:45:18 UTC
choose() question
Hi all...
Newbie question regarding choose(). Given
from(endpoint).choose()
.when(predA).process(processorA)
.when(predB).process(processorB);
If predA and predB are both true, do processorA and processorB both
get called? Or does processing stop with processorA?
Don
Re: choose() question
Posted by Norman Maurer <no...@apache.org>.
I think it should be
Exchange.ROUTE_STOP.
Bye,
Norman
2010/9/16 Claus Ibsen <cl...@gmail.com>:
> You can use an interceptor and then stop() when to abort.
>
> Or you can set the Exchange.STOP property on the Exchange from a
> Processor to tell it to stop
>
>
> On Thu, Sep 16, 2010 at 7:04 PM, Donald Whytock <dw...@gmail.com> wrote:
>> Is there something along the lines of an abortable Pipeline, such that
>> it will go through a sequence of processors until one of them returns
>> a certain value, sets a property on the exchange, etc?
>>
>> On Thu, Sep 16, 2010 at 12:49 PM, Claus Ibsen <cl...@gmail.com> wrote:
>>> On Thu, Sep 16, 2010 at 6:45 PM, Donald Whytock <dw...@gmail.com> wrote:
>>>> Hi all...
>>>>
>>>> Newbie question regarding choose(). Given
>>>>
>>>> from(endpoint).choose()
>>>> .when(predA).process(processorA)
>>>> .when(predB).process(processorB);
>>>>
>>>> If predA and predB are both true, do processorA and processorB both
>>>> get called? Or does processing stop with processorA?
>>>>
>>>
>>> Only the first one is chosen. (its not a case, always only 1 at most
>>> is selected)
>>>
>>>
>>>> Don
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
Re: choose() question
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Sep 17, 2010 at 11:58 PM, Donald Whytock <dw...@gmail.com> wrote:
> Can I chain whens? As in,
> from(endpoint).when(pred1).when(pred2).when(pred3).process(processor),
> where processor gets invoked only if all the preds return true? Or
> does a when need to be followed by something-not-a-when?
>
Only one when, but you can chain predicates.
http://davsclaus.blogspot.com/2009/02/apache-camel-and-using-compound.html
> On Thu, Sep 16, 2010 at 1:06 PM, Claus Ibsen <cl...@gmail.com> wrote:
>> You can use an interceptor and then stop() when to abort.
>>
>> Or you can set the Exchange.STOP property on the Exchange from a
>> Processor to tell it to stop
>>
>>
>> On Thu, Sep 16, 2010 at 7:04 PM, Donald Whytock <dw...@gmail.com> wrote:
>>> Is there something along the lines of an abortable Pipeline, such that
>>> it will go through a sequence of processors until one of them returns
>>> a certain value, sets a property on the exchange, etc?
>>>
>>> On Thu, Sep 16, 2010 at 12:49 PM, Claus Ibsen <cl...@gmail.com> wrote:
>>>> On Thu, Sep 16, 2010 at 6:45 PM, Donald Whytock <dw...@gmail.com> wrote:
>>>>> Hi all...
>>>>>
>>>>> Newbie question regarding choose(). Given
>>>>>
>>>>> from(endpoint).choose()
>>>>> .when(predA).process(processorA)
>>>>> .when(predB).process(processorB);
>>>>>
>>>>> If predA and predB are both true, do processorA and processorB both
>>>>> get called? Or does processing stop with processorA?
>>>>>
>>>>
>>>> Only the first one is chosen. (its not a case, always only 1 at most
>>>> is selected)
>>>>
>>>>
>>>>> Don
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: choose() question
Posted by Donald Whytock <dw...@gmail.com>.
Can I chain whens? As in,
from(endpoint).when(pred1).when(pred2).when(pred3).process(processor),
where processor gets invoked only if all the preds return true? Or
does a when need to be followed by something-not-a-when?
On Thu, Sep 16, 2010 at 1:06 PM, Claus Ibsen <cl...@gmail.com> wrote:
> You can use an interceptor and then stop() when to abort.
>
> Or you can set the Exchange.STOP property on the Exchange from a
> Processor to tell it to stop
>
>
> On Thu, Sep 16, 2010 at 7:04 PM, Donald Whytock <dw...@gmail.com> wrote:
>> Is there something along the lines of an abortable Pipeline, such that
>> it will go through a sequence of processors until one of them returns
>> a certain value, sets a property on the exchange, etc?
>>
>> On Thu, Sep 16, 2010 at 12:49 PM, Claus Ibsen <cl...@gmail.com> wrote:
>>> On Thu, Sep 16, 2010 at 6:45 PM, Donald Whytock <dw...@gmail.com> wrote:
>>>> Hi all...
>>>>
>>>> Newbie question regarding choose(). Given
>>>>
>>>> from(endpoint).choose()
>>>> .when(predA).process(processorA)
>>>> .when(predB).process(processorB);
>>>>
>>>> If predA and predB are both true, do processorA and processorB both
>>>> get called? Or does processing stop with processorA?
>>>>
>>>
>>> Only the first one is chosen. (its not a case, always only 1 at most
>>> is selected)
>>>
>>>
>>>> Don
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
Re: choose() question
Posted by Claus Ibsen <cl...@gmail.com>.
You can use an interceptor and then stop() when to abort.
Or you can set the Exchange.STOP property on the Exchange from a
Processor to tell it to stop
On Thu, Sep 16, 2010 at 7:04 PM, Donald Whytock <dw...@gmail.com> wrote:
> Is there something along the lines of an abortable Pipeline, such that
> it will go through a sequence of processors until one of them returns
> a certain value, sets a property on the exchange, etc?
>
> On Thu, Sep 16, 2010 at 12:49 PM, Claus Ibsen <cl...@gmail.com> wrote:
>> On Thu, Sep 16, 2010 at 6:45 PM, Donald Whytock <dw...@gmail.com> wrote:
>>> Hi all...
>>>
>>> Newbie question regarding choose(). Given
>>>
>>> from(endpoint).choose()
>>> .when(predA).process(processorA)
>>> .when(predB).process(processorB);
>>>
>>> If predA and predB are both true, do processorA and processorB both
>>> get called? Or does processing stop with processorA?
>>>
>>
>> Only the first one is chosen. (its not a case, always only 1 at most
>> is selected)
>>
>>
>>> Don
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: choose() question
Posted by Donald Whytock <dw...@gmail.com>.
Is there something along the lines of an abortable Pipeline, such that
it will go through a sequence of processors until one of them returns
a certain value, sets a property on the exchange, etc?
On Thu, Sep 16, 2010 at 12:49 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Thu, Sep 16, 2010 at 6:45 PM, Donald Whytock <dw...@gmail.com> wrote:
>> Hi all...
>>
>> Newbie question regarding choose(). Given
>>
>> from(endpoint).choose()
>> .when(predA).process(processorA)
>> .when(predB).process(processorB);
>>
>> If predA and predB are both true, do processorA and processorB both
>> get called? Or does processing stop with processorA?
>>
>
> Only the first one is chosen. (its not a case, always only 1 at most
> is selected)
>
>
>> Don
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
Re: choose() question
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Sep 16, 2010 at 6:45 PM, Donald Whytock <dw...@gmail.com> wrote:
> Hi all...
>
> Newbie question regarding choose(). Given
>
> from(endpoint).choose()
> .when(predA).process(processorA)
> .when(predB).process(processorB);
>
> If predA and predB are both true, do processorA and processorB both
> get called? Or does processing stop with processorA?
>
Only the first one is chosen. (its not a case, always only 1 at most
is selected)
> Don
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus