camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-9249) timer - Allow to specify a delay of -1 or something to indicate loop asap forever
Date Sat, 24 Oct 2015 12:27:27 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-9249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14972571#comment-14972571
] 

Claus Ibsen commented on CAMEL-9249:
------------------------------------

Ah sorry we need a background thread to do the looping, you cannot do this in the event listener.

You can use
org.apache.camel.spi.ExecutorServiceManager#newSingleThreadExecutor

And take a look at how some of the existing source uses that.

Also the loop need to check for isRunAllowed() in case the route is stopped, then the loop
has to break out.

For example take a look at
org.apache.camel.component.dataset.DataSetConsumer

> timer - Allow to specify a delay of -1 or something to indicate loop asap forever
> ---------------------------------------------------------------------------------
>
>                 Key: CAMEL-9249
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9249
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Claus Ibsen
>             Fix For: 2.17.0
>
>
> If you want to let a route trigger as fast as possible, then by settinh
> from timer:fast?delay=-1
>    to http blah
> then with the timer we can detect its a delay < 0 and then instead of using a timer,
then do a processor that's in a while loop and then keep routing
> {code}
> while (isRunAllowed) {
>    create exchange
>    process exchange
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message