cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: [cron block] Execute job with original request setup
Date Fri, 11 Mar 2005 15:11:17 GMT
Andreas Hartmann wrote:
> Hi Cocoon devs,
> 
> in the process of moving the Lenya scheduler to Cocoon components,
> I played a little bit with the cron block.
> 
> At first I tried to invoke a Lenya service from the scheduler by
> obtaining the service directly via the ServiceableJob's service manager.
> But this way I ended up with exceptions, because the request URI
> was empty. Originally, the service was only invoked from the web
> interface via flowscript.
> 
> Some questions:
> 
> 1) Is it possible to initialize a cron job with the original environment
>    information?

What's "original environment" in the context of a cron job? There is no 
environment there, only service manager.


> 2) Or is it unwise to implement Contextualizable and access the request
>    object via the ContextHelper in services which can be called from
>    the scheduler? If yes, would that mean I should pass the request
>    URI etc. manually?

What is "URI" for a cron task? You can think in terms of unix cron, if it is helps.

Probably ConfigurableCronJob is what you need - so that you can pass parameters 
into the job. Or, you can take a look at the CocoonPipelineCronJob which 
*creates* new background environment and invokes particular pipeline - so in 
this case you'll have the request with URI as created by the cron job.

Vadim


> 3) Are there any general hints how to implement such a behaviour
>    (call the same service from web interface and scheduler)?
> 
> Thanks in advance!
> 
> -- Andreas

Mime
View raw message