Hi,

    My question is maybe not related to the topic directly, but I
would like to get your opinions. Is it good approach to design
applications in a way that the routes are dynamically started and
stopped? As I understand, one of the good points about Camel routes is
that they are declarative. That makes the system simpler, there is
less room for bugs, etc. By managing routes dynamically, one broke
that simplicity.

   In the case of the problem, discussed in this thread, maybe it
would be better approach to have static route consuming files from the
folder B, and second route, initiated by a timer, that moves files at
6AM from the folder A (inbox) to the folder B? Another possible
approach could be to have an aggregator in the route with completion
expression specified accordingly (maybe file references instead of
streams should be passed in such case)? Other solutions could be
enumerated here also, but the main point here is that the routes
should be static.

Karolis

On Sun, Aug 26, 2012 at 10:19 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> On Sun, Aug 26, 2012 at 9:14 AM, Pontus Ullgren <ullg...@gmail.com> wrote:
>> Hello,
>>
>> You can combine the CronScheduledRoutePolicy with the use of the
>> sendEmptyMessageWhenIdle option of the file component [1].
>> You will then get a empty message when there are no more files left
>> and you can then suspend or stop [2] the route.
>>
>
> Yeah that is also a good solution. As the empty message will only be
> sent when there is no more files in a separate poll.
> The only trick parts is that your routing logic would need to cater
> for an "empty message" being routed.
>
>> [1] http://camel.apache.org/file2.html
>> [2] http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
>>
>> Best regards
>> Pontus Ullgren
>>
>> On Sat, Aug 25, 2012 at 7:13 PM, Ashwin Pejavar
>> <ashwin.peja...@gmail.com> wrote:
>>> I have a use-case where I need to consume files at a fixed cron schedule.
>>>
>>> For example, I need my input route to resume everyday at 6AM, process all
>>> files collected in the input directory and go into suspension till 6AM the
>>> following day.
>>>
>>> I was hoping the CronScheduledRoutePolicy would be useful, but that doesn't
>>> quite do what I need. I can use it to start the route at 6AM, but there
>>> seems to be no way of automatically suspending it when all the files are
>>> processed.
>>>
>>> Is there a way of doing this in Camel?
>>>
>>>
>>>
>>> --
>>> View this message in context: 
>>> http://camel.465427.n5.nabble.com/Periodic-route-activation-use-case-tp5718059.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to