Vadim Gritsenko wrote:
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.

I had to adjust my viewpoint a little and changed the way the cron job works. The original URL (of the request which created and scheduled the job) is stored in the job and passed to all services which depend on the URL.


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?

I meant the original URL if the request which led to the scheduling of the cron job. A typical example is a publishing Job in Lenya. The URL is used to determine the document to be published.


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.

That was exactly what I needed. Thank you very much.

-- Andreas



Reply via email to