You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marco Crivellaro <ma...@optasports.com> on 2010/08/05 12:34:14 UTC

camel 2.5 recipientList aggregationStrategy timeout

I've noticed you introduced a new timeout for recipientList aggregation,
I can't find a way of adding it to my route:

from("jms-cif:queue:" + _notificationQueue).process(processor)												
						.onException(Exception.class).retryWhile(bean("myRetryBean")).end()
						.recipientList(header("recipientListHeader").tokenize(","))						
						.parallelProcessing()
						.executorService(customThreadPoolExecutor)
						.streaming()
						.aggregationStrategy(new
RecipientAggregationStrategy(deliveryEndpoints, _endpointDeliveredBaseUri))
						.to("direct:chunk.completed");

regards,
Marco
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2265144.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel 2.5 recipientList aggregationStrategy timeout

Posted by Sri <sr...@googlemail.com>.
We are already using camel.ftp 2.5 SNAPSHOT version 
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2419602.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel 2.5 recipientList aggregationStrategy timeout

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Aug 6, 2010 at 1:23 PM, Marco Crivellaro
<ma...@optasports.com> wrote:
>
> I've tried current snapshot; the timeout is working as expected, although the
> task doesn't get cancelled.
> I receive messages from running thread (connection timeout to an FTP) after
> the timeout is raised (many seconds afterwards).
>

What do you mean precisely by receiving message? Could you detail
exactly what you see?

It's the responsibility of the JDK to cancel the task which it tries
doing by interrupting it. But I speculate many 3rd party libraries
just ignore the interrupt exception.

> you can try this behaviour by seding and FTP exchange to an IP which does
> not exist in your network and setting the timeout to a low value.
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2266518.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
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: camel 2.5 recipientList aggregationStrategy timeout

Posted by Claus Ibsen <cl...@gmail.com>.
You need to update camel-ftp as well, to use 2.5-SNAPSHOT.


On Mon, Aug 9, 2010 at 10:05 AM, Marco Crivellaro
<mc...@optasportsdata.com> wrote:
>
> I am still receiving the FTP connection timeout error after a while the
> aggregation is runned in timeout.
> I still don't understand why it runs in connection timeout after the
> specified timeout though (I've already opened a discussion for this).
>
> 2010-08-09 09:02:36,221 [pool-1-thread-2] DEBUG
> org.apache.camel.component.file.remote.RemoteFileProducer  - Could not
> connect to:
> Endpoint[ftp://USERNAME@192.168.1.1/FOLDER?eagerDeleteTargetFile=false&fileName=test.txt&ftpClient.connectTimeout=120000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&password=OPT2%24%24d2t2%23888&soTimeout=60000&tempFileName=%24%7Bfile%3Aname.noext%7D.tmp].
> Will try to recover.
> org.apache.camel.component.file.GenericFileOperationFailedException: File
> operation failed: null Connection timed out: connect. Code: 0
>        at
> org.apache.camel.component.file.remote.FtpOperations.connect(FtpOperations.java:107)
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2268527.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
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: camel 2.5 recipientList aggregationStrategy timeout

Posted by Marco Crivellaro <mc...@optasportsdata.com>.
I am still receiving the FTP connection timeout error after a while the
aggregation is runned in timeout.
I still don't understand why it runs in connection timeout after the
specified timeout though (I've already opened a discussion for this).

2010-08-09 09:02:36,221 [pool-1-thread-2] DEBUG
org.apache.camel.component.file.remote.RemoteFileProducer  - Could not
connect to:
Endpoint[ftp://USERNAME@192.168.1.1/FOLDER?eagerDeleteTargetFile=false&fileName=test.txt&ftpClient.connectTimeout=120000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&password=OPT2%24%24d2t2%23888&soTimeout=60000&tempFileName=%24%7Bfile%3Aname.noext%7D.tmp].
Will try to recover.
org.apache.camel.component.file.GenericFileOperationFailedException: File
operation failed: null Connection timed out: connect. Code: 0
	at
org.apache.camel.component.file.remote.FtpOperations.connect(FtpOperations.java:107)

-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2268527.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel 2.5 recipientList aggregationStrategy timeout

Posted by Marco Crivellaro <mc...@optasportsdata.com>.
That is exactly what I am experiencing (sorry for the late reply).
If an FTP endpoint is not reliable I am not receiving a connection timeout
even though I've set it to 10 secs or less; the timeout is raised after
several minutes (even 60mins)... in such a case the recipient list runs in
timeout in the specified time but a the thread handling the FTP connection
will return the exception after the timeout (remaining active for a long
time).

I will test latest version tomorrow and let you know.
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2268129.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel 2.5 recipientList aggregationStrategy timeout

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Aug 6, 2010 at 1:23 PM, Marco Crivellaro
<ma...@optasports.com> wrote:
>
> I've tried current snapshot; the timeout is working as expected, although the
> task doesn't get cancelled.
> I receive messages from running thread (connection timeout to an FTP) after
> the timeout is raised (many seconds afterwards).
>
> you can try this behaviour by seding and FTP exchange to an IP which does
> not exist in your network and setting the timeout to a low value.
> --

I have committed an improvement to camel-ftp to detect the
interruption better. However the FTP library may still not honor the
interruption asap.
So if you have a high connection timeout (default is 10sec) then the
cancellation most likely wont trigger until after the connection
timeout from the FTP library.


> View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2266518.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
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: camel 2.5 recipientList aggregationStrategy timeout

Posted by Marco Crivellaro <ma...@optasports.com>.
I've tried current snapshot; the timeout is working as expected, although the
task doesn't get cancelled.
I receive messages from running thread (connection timeout to an FTP) after
the timeout is raised (many seconds afterwards).

you can try this behaviour by seding and FTP exchange to an IP which does
not exist in your network and setting the timeout to a low value.
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2266518.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel 2.5 recipientList aggregationStrategy timeout

Posted by Claus Ibsen <cl...@gmail.com>.
I have committed an improvement in the routing engine to detect cancelled tasks.
Can you test with updated source code?



On Thu, Aug 5, 2010 at 2:37 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Thu, Aug 5, 2010 at 2:30 PM, Marco Crivellaro
> <ma...@optasports.com> wrote:
>>
>> the problem I see right now is that in case aggregation runs in timeout the
>> endpoint processing thread is not aborted, I am not sure on how to demo as
>> unit test such a thing
>> --
>
> Its the JDK that is responsible for "aborting" that thread, which is
> done when you cancel the task.
> However there may be some logic which "ignores" the JDK aborting and
> force the Exchange to continue.
>
> Let me look at it bit later.
>
> But please post the route you use now with the retryUntil stuff.
>
>
>
>> View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2265258.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> 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: camel 2.5 recipientList aggregationStrategy timeout

Posted by Marco Crivellaro <ma...@optasports.com>.
This is the route I am currently using:

from("jms-cif:queue:" + _notificationQueue).process(processor)												
.onException(Exception.class).retryWhile(bean("myRetryBean")).end()
.recipientList(header("recipientListHeader").tokenize(","))						
.parallelProcessing()
.timeout(5000)
.executorService(customThreadPoolExecutor)
.streaming()
.aggregationStrategy(new RecipientAggregationStrategy(deliveryEndpoints,
_endpointDeliveredBaseUri))
.to("direct:chunk.completed");
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2265279.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel 2.5 recipientList aggregationStrategy timeout

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Aug 5, 2010 at 2:30 PM, Marco Crivellaro
<ma...@optasports.com> wrote:
>
> the problem I see right now is that in case aggregation runs in timeout the
> endpoint processing thread is not aborted, I am not sure on how to demo as
> unit test such a thing
> --

Its the JDK that is responsible for "aborting" that thread, which is
done when you cancel the task.
However there may be some logic which "ignores" the JDK aborting and
force the Exchange to continue.

Let me look at it bit later.

But please post the route you use now with the retryUntil stuff.



> View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2265258.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
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: camel 2.5 recipientList aggregationStrategy timeout

Posted by Marco Crivellaro <ma...@optasports.com>.
the problem I see right now is that in case aggregation runs in timeout the
endpoint processing thread is not aborted, I am not sure on how to demo as
unit test such a thing
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2265258.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel 2.5 recipientList aggregationStrategy timeout

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Aug 5, 2010 at 1:31 PM, Marco Crivellaro
<ma...@optasports.com> wrote:
>
> sorry this was my fault, I don't know why but it was recognize by multicast
> processor and not recipentlist,
> now it is working fine.
>
> my route has a retry bean, is there a way to cancel retrying in case the
> aggregation runs in timeout?
>
> currenlty in case it runs in timeout my route hits the end but the retry
> bean keeps retrying for the endpoint running in error
> --

The task should be cancelled, which may force it to throw an interrupt
exception which the retry bean may just catch and retry.

Can you post an unit test which demonstrates this issue? That would
make it much easier to fix the problem.


> View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2265188.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
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: camel 2.5 recipientList aggregationStrategy timeout

Posted by Marco Crivellaro <ma...@optasports.com>.
sorry this was my fault, I don't know why but it was recognize by multicast
processor and not recipentlist,
now it is working fine.

my route has a retry bean, is there a way to cancel retrying in case the
aggregation runs in timeout?

currenlty in case it runs in timeout my route hits the end but the retry
bean keeps retrying for the endpoint running in error
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2265188.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel 2.5 recipientList aggregationStrategy timeout

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Aug 5, 2010 at 1:07 PM, Marco Crivellaro
<ma...@optasports.com> wrote:
>
> I am using 2.5-SNAPSHOT I've updated my local repo this morning
>
> timeout seems to have a problem even on your Unit test route:
>
> from("direct:start")
>                .recipientList(header("slip")).aggregationStrategy(
>                        new AggregationStrategy() {
>                        public Exchange aggregate(Exchange oldExchange,
> Exchange newExchange) {
>                            if (oldExchange == null) {
>                                return newExchange;
>                            }
>
>                            String body =
> oldExchange.getIn().getBody(String.class);
>                            oldExchange.getIn().setBody(body +
> newExchange.getIn().getBody(String.class));
>                            return oldExchange;
>                        }
>                    })
>                    .parallelProcessing().timeout(2000)
>                .to("mock:result");
>

The unit test works perfect. It has been tested by an army of
different servers in the CI farm.
Could be some weird on your end. Try compile from a cmd line or
something. And ensure you dont have old jars in the classpath.

And what error do you get?


>
>
> it looks fine on multicast route:
>                                from("direct:start")
>                            .multicast(new AggregationStrategy() {
>                                    public Exchange aggregate(Exchange oldExchange, Exchange
> newExchange) {
>                                        if (oldExchange == null) {
>                                            return newExchange;
>                                        }
>
>                                        String body = oldExchange.getIn().getBody(String.class);
>                                        oldExchange.getIn().setBody(body +
> newExchange.getIn().getBody(String.class));
>                                        return oldExchange;
>                                    }
>                                })
>                                .parallelProcessing().timeout(2000).to("direct:a", "direct:b",
> "direct:c")
>                            // use end to indicate end of multicast route
>                            .end()
>                            .to("mock:result");
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2265166.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
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: camel 2.5 recipientList aggregationStrategy timeout

Posted by Marco Crivellaro <ma...@optasports.com>.
I am using 2.5-SNAPSHOT I've updated my local repo this morning

timeout seems to have a problem even on your Unit test route:

from("direct:start")
                .recipientList(header("slip")).aggregationStrategy(
                        new AggregationStrategy() {
                        public Exchange aggregate(Exchange oldExchange,
Exchange newExchange) {
                            if (oldExchange == null) {
                                return newExchange;
                            }

                            String body =
oldExchange.getIn().getBody(String.class);
                            oldExchange.getIn().setBody(body +
newExchange.getIn().getBody(String.class));
                            return oldExchange;
                        }
                    })
                    .parallelProcessing().timeout(2000)
                .to("mock:result");



it looks fine on multicast route:
				from("direct:start")
			    .multicast(new AggregationStrategy() {
			            public Exchange aggregate(Exchange oldExchange, Exchange
newExchange) {
			                if (oldExchange == null) {
			                    return newExchange;
			                }

			                String body = oldExchange.getIn().getBody(String.class);
			                oldExchange.getIn().setBody(body +
newExchange.getIn().getBody(String.class));
			                return oldExchange;
			            }
			        })
			        .parallelProcessing().timeout(2000).to("direct:a", "direct:b",
"direct:c")
			    // use end to indicate end of multicast route
			    .end()
			    .to("mock:result");
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2265166.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel 2.5 recipientList aggregationStrategy timeout

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Aug 5, 2010 at 12:34 PM, Marco Crivellaro
<ma...@optasports.com> wrote:
>
> I've noticed you introduced a new timeout for recipientList aggregation,
> I can't find a way of adding it to my route:
>
> from("jms-cif:queue:" + _notificationQueue).process(processor)
>                                                .onException(Exception.class).retryWhile(bean("myRetryBean")).end()
>                                                .recipientList(header("recipientListHeader").tokenize(","))
>                                                .parallelProcessing()
>                                                .executorService(customThreadPoolExecutor)
>                                                .streaming()
>                                                .aggregationStrategy(new
> RecipientAggregationStrategy(deliveryEndpoints, _endpointDeliveredBaseUri))
>                                                .to("direct:chunk.completed");
>

And you are using camel-core-2.5-SNAPSHOT.jar ?

See this unit test in camel-core: RecipientListParallelTimeoutTest

> regards,
> Marco
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-2-5-recipientList-aggregationStrategy-timeout-tp2265144p2265144.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
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