You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Seiji Sogabe <s....@gmail.com> on 2014/12/14 06:27:25 UTC
Unexpected behaviour of splitter using stopOnException
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
Re: Unexpected behaviour of splitter using stopOnException
Posted by Taariq Levack <ta...@gmail.com>.
What version of Camel is that?
I get the expected output with <stop/> commented out.
[pache.camel.spring.Main.main()] SpringCamelContext INFO
Apache Camel 2.14.0 (CamelContext: camel-1) started in 0.382 seconds
[ thread #0 - dataset://dataSet] route1 INFO 1
[ thread #0 - dataset://dataSet] route1 INFO do
something
[ thread #0 - dataset://dataSet] route1 INFO 2
[ thread #0 - dataset://dataSet] route1 INFO do
something
[ thread #0 - dataset://dataSet] route1 INFO 3
[ thread #0 - dataset://dataSet] route1 INFO do
something
[ thread #0 - dataset://dataSet] route1 INFO 4
[ thread #0 - dataset://dataSet] route1 INFO do
something
[ thread #0 - dataset://dataSet] route1 INFO 5
[ thread #0 - dataset://dataSet] route1 INFO do
something
[ thread #0 - dataset://dataSet] route1 INFO 1
[ thread #0 - dataset://dataSet] route1 INFO do
something
[ thread #0 - dataset://dataSet] route1 INFO 2
[ thread #0 - dataset://dataSet] route1 INFO do
something
[ thread #0 - dataset://dataSet] route1 INFO 3
[ thread #0 - dataset://dataSet] route1 INFO do
something
[ thread #0 - dataset://dataSet] route1 INFO 4
[ thread #0 - dataset://dataSet] route1 INFO do
something
[ thread #0 - dataset://dataSet] route1 INFO 5
[ thread #0 - dataset://dataSet] route1 INFO do
something
On Sun, Dec 14, 2014 at 11:46 AM, Seiji Sogabe <s....@gmail.com> wrote:
>
> 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 <ta...@gmail.com>:
> > Hi Seiji
> > Try without the <stop/>
> >
> > Taariq
> >
> >
> >> On 14 Dec 2014, at 07:27, Seiji Sogabe <s....@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
>
Re: Unexpected behaviour of splitter using stopOnException
Posted by Seiji Sogabe <s....@gmail.com>.
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 <ta...@gmail.com>:
> Hi Seiji
> Try without the <stop/>
>
> Taariq
>
>
>> On 14 Dec 2014, at 07:27, Seiji Sogabe <s....@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
Re: Unexpected behaviour of splitter using stopOnException
Posted by Taariq Levack <ta...@gmail.com>.
Hi Seiji
Try without the <stop/>
Taariq
> On 14 Dec 2014, at 07:27, Seiji Sogabe <s....@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