You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Nicolas74 <nm...@gnubila.fr> on 2015/11/01 19:25:11 UTC

Stop a route after execution and restart it later

Hello Camel guys

/Camel version 2.15.2/

I created a Camel component to be able to download files from a PACS server.
Basically, it's the consumer (that extends the DefaultConsumer class) that
will download the files from the server.

What I'm trying to do is the following:
1) With the file component, I retrieve a CSV file
2) With a processor, I process the CSV that contains information about the
location and name of the file(s) to download from the PACS.
3) Once the process is finished, I want to start the PACS route.
4) Retrieve the files with my own PACS component
5) Shutdown the PACS route until a new CSV file is processed (cf 1) 2) and
3) ).

Everything works properly except for the shutdown of the PACS route.
The code:



I'm not able to stop my route...

Any idea(s) that could help me please ? Maybe it's not the best way to
achieve what I want to do...

Best,
Nicolas.



--
View this message in context: http://camel.465427.n5.nabble.com/Stop-a-route-after-execution-and-restart-it-later-tp5773311.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Stop a route after execution and restart it later

Posted by Nicolas74 <nm...@gnubila.fr>.
Hi Claus,

Yep, I'm using the control bus as follows:
<camel:camelContext id="pacsContext"
xmlns="http://camel.apache.org/schema/spring" >

        <propertyPlaceholder id="properties"
location="file:${catalina.home}/../etc/config.properties"/>

         <camel:route id="KICK_OFF_PACS">
          <camel:from uri="file:{{local.inputDir}}?consumer.delay=5000" />
          ... process the CSV to get information in order to use my own PACS
component
                <camel:to
uri="controlbus:route?routeId=PACS&amp;action=start" />
         </camel:route>

         <camel:route id="PACS" autoStartup="false" >
         
          <camel:from uri="pacs:....... />
          ... process the retrieved files with mw own PACS component
                <camel:to
uri="controlbus:route?routeId=PACS&amp;action=stop" />
         </camel:route>

</camel:camelContext>



--
View this message in context: http://camel.465427.n5.nabble.com/Stop-a-route-after-execution-and-restart-it-later-tp5773311p5773316.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Stop a route after execution and restart it later

Posted by Claus Ibsen <cl...@gmail.com>.
Have you looked at controlbus
http://camel.apache.org/controlbus

And there is also this FAQ
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

On Sun, Nov 1, 2015 at 7:25 PM, Nicolas74 <nm...@gnubila.fr> wrote:
> Hello Camel guys
>
> /Camel version 2.15.2/
>
> I created a Camel component to be able to download files from a PACS server.
> Basically, it's the consumer (that extends the DefaultConsumer class) that
> will download the files from the server.
>
> What I'm trying to do is the following:
> 1) With the file component, I retrieve a CSV file
> 2) With a processor, I process the CSV that contains information about the
> location and name of the file(s) to download from the PACS.
> 3) Once the process is finished, I want to start the PACS route.
> 4) Retrieve the files with my own PACS component
> 5) Shutdown the PACS route until a new CSV file is processed (cf 1) 2) and
> 3) ).
>
> Everything works properly except for the shutdown of the PACS route.
> The code:
>
>
>
> I'm not able to stop my route...
>
> Any idea(s) that could help me please ? Maybe it's not the best way to
> achieve what I want to do...
>
> Best,
> Nicolas.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Stop-a-route-after-execution-and-restart-it-later-tp5773311.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition