camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Seiji Sogabe <s.sog...@gmail.com>
Subject Re: Unexpected behaviour of splitter using stopOnException
Date Sun, 14 Dec 2014 09:46:22 GMT
Hi,

Thanls for reply.

It is test code for checking the behaviour of stopOnException option.

DataSet is like this:

    public class BookDataSet extends DataSetSupport {

        @Override
        protected Object createMessageBody(long messageIndex) {
            return new int[] { 1, 2 , 3, 4, 5 };
       }
    }

(1) If stopOnException is *false*, output is like this:

18:30:52,626 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 1
18:30:52,631 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 2
18:30:52,632 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 3
18:30:52,632 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 4
18:30:52,633 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 5
18:30:53,638 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 1
18:30:53,638 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 2
18:30:53,639 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 3
18:30:53,640 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 4
18:30:53,641 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 5

It seems that Camel processes the sub-messages.

(2) If stopOnException is *true*, output is like this:

18:34:23,671 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 1
18:34:24,680 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 1
18:34:25,684 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 1
18:34:26,689 [Camel (camel-1) thread #0 - dataset://bookDataSet] [INFO] 1

<stop /> does not throw an exception, but it acts like  an exception is thrown.



2014-12-14 17:46 GMT+09:00 Taariq Levack <taariql@gmail.com>:
> Hi Seiji
> Try without the <stop/>
>
> Taariq
>
>
>> On 14 Dec 2014, at 07:27, Seiji Sogabe <s.sogabe@gmail.com> wrote:
>>
>> Hi,
>>
>> I have a simple camel route:
>>
>>
>>        <route>
>>            <from uri="dataset:dataSet?produceDelay=1000" />
>>            <split stopOnException="true">
>>                <simple>body</simple>
>>                <log message="${body}" />
>>                <stop />    ... (*)
>>                <log message="do something" />
>>            </split>
>>        </route>
>>
>> According to the [1], stopOnException means
>>
>> "Whether or not to stop continue processing immediately when *an
>> exception occurred*. If disable, then Camel continue splitting and
>> process the sub-messages regardless if one of them failed. "
>>
>> But, it stops processing the sub-messages even if no exception occurred.
>>
>> Is this a bug or not?
>>
>> Regards,
>>
>> Seiji Sogabe
>>
>>
>> [1] http://camel.apache.org/splitter.html
>> --
>> s.sogabe at gmail.com



-- 
s.sogabe at gmail.com

Mime
View raw message