I make all of my batch jobs Tapestry pages and use Hudson scheduled tasks
to access them. This give you more control, job history and email
notifications on failure. Since the jobs are just pages you can just go to
them to debug them and things like PageRenderLinkSource work as you would
expect. I run thousands of jobs this way every day. The history and
notifications alone are worth it and you can even build/deploy your
application with it.


On Fri, Sep 6, 2013 at 3:12 AM, Nathan Quirynen <nat...@pensionarchitects.be
> wrote:

> Hi,
>
> I added a scheduled job to my Tapestry application, where I want to daily
> check if there are new tickets and send a mail to people assigned to these
> tickets.
> So I've added it in AppModule as following:
>
>     @Startup
>     public static void scheduleJobs(
>             PeriodicExecutor executor,
>             final MailService mailService) {
>
>         executor.addJob(
>                 new CronSchedule("* 8 * * * ?"),
>                 "Cleanup Job",
>                 new Runnable() {
>                     @Override
>                     public void run() {
> mailService.mailNewTickets(**now().minusHours(24));
>                     }
>                 });
>     }
>
> This works perfect. Only I want to add links to the ticket detail page in
> these mails.
> So I injected PageRenderLinkSource in my MailService class to create links
> with context:
>
> pageRenderLinkSource.**createPageRenderLinkWithContex**t(TicketDetails.class,
> ticket.getId()).toAbsoluteURI(**true);
>
> But this is not working as the scheduled job stops there. I don't see the
> exception thrown, probably because it's in another thread?
> Maybe this is expected behaviour (Request not available?), but I don't
> know how to create the links otherwise besides using a hard coded string
> and concatenating the context.
>
> Nathan
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to