Hi all guys,
after Terracotta announced the new Quartz API release, I started
working on GitHub on a new implementation of Guice+Quartz integration,
based on the previous version that Nino Martinez Wael and I did on
GoogleCode.
APIs are simple, all users have to do is plugging a QuartzModule in
the Guice.createInjector() method and specify their scheduling:
{code}
Guice.createInjector(..., new org.nnsoft.guice.guartz.QuartzModule() {
@Override
protected void schedule() {
...
scheduleJob(com.acme.MyJobImpl.class).withCronExpression("0/2 *
* * * ?"); // see javadoc APIs to see more options
...
}
});
{code}
or using implicit scheduling:
{code}
@javax.inject.Singleton
@org.nnsoft.guice.guartz.Scheduled(jobName = "test", cronExpression =
"0/2 * * * * ?") // see javadoc APIs to see more parameters
public class com.acme.MyJobImpl implements org.quartz.Job {
@javax.inject.Inject
private MyCustomService service;
public void execute(JobExecutionContext context) throws
JobExecutionException {
service.customOperation();
}
}
{code}
Then, when creating the Injector instance:
{code}
Guice.createInjector(..., new org.nnsoft.guice.guartz.QuartzModule() {
@Override
protected void schedule() {
...
scheduleJob(com.acme.MyJobImpl.class);
...
}
});
{code}
And the magic happens! The scheduler will be launched and Job
scheduled, that's all :)
For those interested, they can find documentation on gh-pages
branch[1] or on the GitHub space[2].
Feedbacks/suggestions/participation is open, just ping directly Nino
or me, we would much more than glad to share your thoughts!!!
Have a nice day, enjoy,
Simo
[1] http://99soft.github.com/guartz/userguide.html
[2] https://github.com/99soft/guartz/
http://people.apache.org/~simonetripodi/
http://www.99soft.org/
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.