You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by alexey-s <al...@mail.ru> on 2012/01/31 07:42:08 UTC

How to stop the Polling Consumer?

Hi.
The process of reading a lot of files in a directory. The content of files
stored in the database.
The database server generates an error ORA-00257: archiver error. Connect
internal only, until freed.
It is necessary to correct an error on the database server. It makes no
sense to continue processing the remaining files.
How to stop the Polling Consumer?

--
View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-the-Polling-Consumer-tp5443781p5443781.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to stop the Polling Consumer?

Posted by alexey-s <al...@mail.ru>.
Hi, thanks for confirmation. 

File Consumer is the successor of Pool Consumer and Batch Consumer.
When you create a File Consumer, uses a pool of 10 threads.
The first thread scans and finds the N files. Consumer runs in a loop
processing of these files. This is how the Batch Consumer.
After the time specified for 'delay', the second thread is started. The new
thread is M new files. This is how the Pool Consumer.

Using a stop in route policy leads to the termination of all threads of Pool
Consumer and stop processing the remaining files in the Batch Consumer.

Stop Batch Consumer timer leads to the fact that the process may stop at the
transition from one to another prosessa.

<route>
   <form uri="file:/mypath">
   <to uri="bean:baeanA"/>
   <to uri="bean:baeanB"/>
</ route>

Can I stop Batch Consumer after all processing of the current message?

Can I stop the current route waiting for the orderly shutdown of the other
threads Pool Consumer?

<route>
   <form uri="file:/mypath?sendEmptyMessageWhenIdle=true">
   <choice>
     <when>
        <simple> $ {in.body} == null </ simple>
        <stop/>
     </ when>
   </ choice>
   <to uri="bean:baeanA"/>
   <to uri="bean:baeanB"/>
</ route>


--
View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-the-Polling-Consumer-tp5443781p5446996.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to stop the Polling Consumer?

Posted by alexey-s <al...@mail.ru>.
Hi, Claus.


http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

Sample stop route after line
"And in the route we create the thread and call the stopRoute method as
shown:"
is no correct.

JavaDoc for method Thread start():
It is never legal to start a thread more than once.
In particular, a thread may not be restarted once it has completed
execution.

Change to



--
Aleksey



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-the-Polling-Consumer-tp5443781p5736849.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to stop the Polling Consumer?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See this FAQ
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

You can use onException to catch those severe exceptions, and then
trigger the route to stop.


Alternatively you can use a route policy, and have it stop/suspend the
route, in case of a severe exception
http://camel.apache.org/routepolicy

Just implement the onExchangeDone, and check that the exchange has an
exception, and if so, whether its a severe exception,
and if so, stop the consumer.



On Tue, Jan 31, 2012 at 7:42 AM, alexey-s <al...@mail.ru> wrote:
> Hi.
> The process of reading a lot of files in a directory. The content of files
> stored in the database.
> The database server generates an error ORA-00257: archiver error. Connect
> internal only, until freed.
> It is necessary to correct an error on the database server. It makes no
> sense to continue processing the remaining files.
> How to stop the Polling Consumer?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-the-Polling-Consumer-tp5443781p5443781.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/