You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by "Robert A. Decker" <de...@robdecker.com> on 2013/10/19 00:19:34 UTC

trying to use the new jobs system

Hi,

I'm trying to set up some jobs using the new jobs system. My first attempt is a periodic job.

Based on the last section here:
http://sling.apache.org/documentation/the-sling-engine/eventing-and-jobs.html

I set up class as:

@Component(enabled = true, immediate = true, metatype = true)
@Service(value = org.quartz.Job.class)
@Properties({@Property(name="scheduler.expression", value="3 0 * * * ?"), @Property(name="scheduler.concurrent", boolValue=false)})
public class DatastorePeriodicGC implements Runnable {

See: I'm trying to use the @Service value of org.quartz.Job.class rather than java.lang.Runnable.class. Runnable works fine for me but I want to try to use org.quartz.Job just because I want to implement everything using the new classes.

So my first question is, where does org.quartz.* come from? I've look through the declarations of the event bundles and I don't see it anywhere. Do I have to bundle it myself? I'm getting import errors.

(lesser importance, will the scheduler.expression run every 3 am?)

Rob


Re: trying to use the new jobs system

Posted by "Robert A. Decker" <de...@robdecker.com>.
Got it working. Thanks. It's using sling's Job type and is running periodically. It's interesting having access to the JobContext now.

Now I'll try making some of the other new job types using the new system.

Rob

On Oct 19, 2013, at 2:08 PM, Carsten Ziegeler wrote:

> Hi Robert,
> 
> the Sling scheduler has support for Runnable and the Job interface which is
> org.apache.sling.commons.scheduler.Job - and not the Quartz one. So you can
> either choose Runnable or the Sling job interface - the Quartz Job
> interface is not supported by the Sling scheduler as we consider Quartz an
> implementation detail, that's why we don't have any exports for the Quartz
> stuff.
> 
> Regards
> Carsten
> 
> 
> 2013/10/19 Robert A. Decker <de...@robdecker.com>
> 
>> And hopefully this documentation for the cron expression applies:
>> http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger
>> 
>> Rob
>> 
>> On Oct 19, 2013, at 1:52 PM, Robert A. Decker wrote:
>> 
>>> Ok, I think I finally found it, poking around in the bundles:
>>> quartz-2.2.0.jar
>>> 
>>> R
>>> 
>>> On Oct 19, 2013, at 12:42 AM, Robert A. Decker wrote:
>>> 
>>>> just noticed, it should probably be:
>>>> public class DatastorePeriodicGC implements Job {
>>>> 
>>>> but my question is still valid - where does org.quartz come from? Can I
>> have the scope as 'provided' in maven? Or do I have to include the
>> dependency as 'compile'? I've look through the eventing bundles and don't
>> see it there.
>>>> 
>>>> But
>>>> 
>>>> On Oct 19, 2013, at 12:19 AM, Robert A. Decker wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> I'm trying to set up some jobs using the new jobs system. My first
>> attempt is a periodic job.
>>>>> 
>>>>> Based on the last section here:
>>>>> 
>> http://sling.apache.org/documentation/the-sling-engine/eventing-and-jobs.html
>>>>> 
>>>>> I set up class as:
>>>>> 
>>>>> @Component(enabled = true, immediate = true, metatype = true)
>>>>> @Service(value = org.quartz.Job.class)
>>>>> @Properties({@Property(name="scheduler.expression", value="3 0 * * *
>> ?"), @Property(name="scheduler.concurrent", boolValue=false)})
>>>>> public class DatastorePeriodicGC implements Runnable {
>>>>> 
>>>>> See: I'm trying to use the @Service value of org.quartz.Job.class
>> rather than java.lang.Runnable.class. Runnable works fine for me but I want
>> to try to use org.quartz.Job just because I want to implement everything
>> using the new classes.
>>>>> 
>>>>> So my first question is, where does org.quartz.* come from? I've look
>> through the declarations of the event bundles and I don't see it anywhere.
>> Do I have to bundle it myself? I'm getting import errors.
>>>>> 
>>>>> (lesser importance, will the scheduler.expression run every 3 am?)
>>>>> 
>>>>> Rob
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org


Re: trying to use the new jobs system

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi Robert,

the Sling scheduler has support for Runnable and the Job interface which is
org.apache.sling.commons.scheduler.Job - and not the Quartz one. So you can
either choose Runnable or the Sling job interface - the Quartz Job
interface is not supported by the Sling scheduler as we consider Quartz an
implementation detail, that's why we don't have any exports for the Quartz
stuff.

Regards
Carsten


2013/10/19 Robert A. Decker <de...@robdecker.com>

> And hopefully this documentation for the cron expression applies:
> http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger
>
> Rob
>
> On Oct 19, 2013, at 1:52 PM, Robert A. Decker wrote:
>
> > Ok, I think I finally found it, poking around in the bundles:
> > quartz-2.2.0.jar
> >
> > R
> >
> > On Oct 19, 2013, at 12:42 AM, Robert A. Decker wrote:
> >
> >> just noticed, it should probably be:
> >> public class DatastorePeriodicGC implements Job {
> >>
> >> but my question is still valid - where does org.quartz come from? Can I
> have the scope as 'provided' in maven? Or do I have to include the
> dependency as 'compile'? I've look through the eventing bundles and don't
> see it there.
> >>
> >> But
> >>
> >> On Oct 19, 2013, at 12:19 AM, Robert A. Decker wrote:
> >>
> >>> Hi,
> >>>
> >>> I'm trying to set up some jobs using the new jobs system. My first
> attempt is a periodic job.
> >>>
> >>> Based on the last section here:
> >>>
> http://sling.apache.org/documentation/the-sling-engine/eventing-and-jobs.html
> >>>
> >>> I set up class as:
> >>>
> >>> @Component(enabled = true, immediate = true, metatype = true)
> >>> @Service(value = org.quartz.Job.class)
> >>> @Properties({@Property(name="scheduler.expression", value="3 0 * * *
> ?"), @Property(name="scheduler.concurrent", boolValue=false)})
> >>> public class DatastorePeriodicGC implements Runnable {
> >>>
> >>> See: I'm trying to use the @Service value of org.quartz.Job.class
> rather than java.lang.Runnable.class. Runnable works fine for me but I want
> to try to use org.quartz.Job just because I want to implement everything
> using the new classes.
> >>>
> >>> So my first question is, where does org.quartz.* come from? I've look
> through the declarations of the event bundles and I don't see it anywhere.
> Do I have to bundle it myself? I'm getting import errors.
> >>>
> >>> (lesser importance, will the scheduler.expression run every 3 am?)
> >>>
> >>> Rob
> >>>
> >>>
> >>
> >>
> >
> >
>
>


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: trying to use the new jobs system

Posted by "Robert A. Decker" <de...@robdecker.com>.
And hopefully this documentation for the cron expression applies:
http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger

Rob

On Oct 19, 2013, at 1:52 PM, Robert A. Decker wrote:

> Ok, I think I finally found it, poking around in the bundles:
> quartz-2.2.0.jar
> 
> R
> 
> On Oct 19, 2013, at 12:42 AM, Robert A. Decker wrote:
> 
>> just noticed, it should probably be:
>> public class DatastorePeriodicGC implements Job {
>> 
>> but my question is still valid - where does org.quartz come from? Can I have the scope as 'provided' in maven? Or do I have to include the dependency as 'compile'? I've look through the eventing bundles and don't see it there.
>> 
>> But
>> 
>> On Oct 19, 2013, at 12:19 AM, Robert A. Decker wrote:
>> 
>>> Hi,
>>> 
>>> I'm trying to set up some jobs using the new jobs system. My first attempt is a periodic job.
>>> 
>>> Based on the last section here:
>>> http://sling.apache.org/documentation/the-sling-engine/eventing-and-jobs.html
>>> 
>>> I set up class as:
>>> 
>>> @Component(enabled = true, immediate = true, metatype = true)
>>> @Service(value = org.quartz.Job.class)
>>> @Properties({@Property(name="scheduler.expression", value="3 0 * * * ?"), @Property(name="scheduler.concurrent", boolValue=false)})
>>> public class DatastorePeriodicGC implements Runnable {
>>> 
>>> See: I'm trying to use the @Service value of org.quartz.Job.class rather than java.lang.Runnable.class. Runnable works fine for me but I want to try to use org.quartz.Job just because I want to implement everything using the new classes.
>>> 
>>> So my first question is, where does org.quartz.* come from? I've look through the declarations of the event bundles and I don't see it anywhere. Do I have to bundle it myself? I'm getting import errors.
>>> 
>>> (lesser importance, will the scheduler.expression run every 3 am?)
>>> 
>>> Rob
>>> 
>>> 
>> 
>> 
> 
> 


Re: trying to use the new jobs system

Posted by "Robert A. Decker" <de...@robdecker.com>.
Ok, I think I finally found it, poking around in the bundles:
quartz-2.2.0.jar

R

On Oct 19, 2013, at 12:42 AM, Robert A. Decker wrote:

> just noticed, it should probably be:
> public class DatastorePeriodicGC implements Job {
> 
> but my question is still valid - where does org.quartz come from? Can I have the scope as 'provided' in maven? Or do I have to include the dependency as 'compile'? I've look through the eventing bundles and don't see it there.
> 
> But
> 
> On Oct 19, 2013, at 12:19 AM, Robert A. Decker wrote:
> 
>> Hi,
>> 
>> I'm trying to set up some jobs using the new jobs system. My first attempt is a periodic job.
>> 
>> Based on the last section here:
>> http://sling.apache.org/documentation/the-sling-engine/eventing-and-jobs.html
>> 
>> I set up class as:
>> 
>> @Component(enabled = true, immediate = true, metatype = true)
>> @Service(value = org.quartz.Job.class)
>> @Properties({@Property(name="scheduler.expression", value="3 0 * * * ?"), @Property(name="scheduler.concurrent", boolValue=false)})
>> public class DatastorePeriodicGC implements Runnable {
>> 
>> See: I'm trying to use the @Service value of org.quartz.Job.class rather than java.lang.Runnable.class. Runnable works fine for me but I want to try to use org.quartz.Job just because I want to implement everything using the new classes.
>> 
>> So my first question is, where does org.quartz.* come from? I've look through the declarations of the event bundles and I don't see it anywhere. Do I have to bundle it myself? I'm getting import errors.
>> 
>> (lesser importance, will the scheduler.expression run every 3 am?)
>> 
>> Rob
>> 
>> 
> 
> 


Re: trying to use the new jobs system

Posted by "Robert A. Decker" <de...@robdecker.com>.
just noticed, it should probably be:
public class DatastorePeriodicGC implements Job {

but my question is still valid - where does org.quartz come from? Can I have the scope as 'provided' in maven? Or do I have to include the dependency as 'compile'? I've look through the eventing bundles and don't see it there.

But

On Oct 19, 2013, at 12:19 AM, Robert A. Decker wrote:

> Hi,
> 
> I'm trying to set up some jobs using the new jobs system. My first attempt is a periodic job.
> 
> Based on the last section here:
> http://sling.apache.org/documentation/the-sling-engine/eventing-and-jobs.html
> 
> I set up class as:
> 
> @Component(enabled = true, immediate = true, metatype = true)
> @Service(value = org.quartz.Job.class)
> @Properties({@Property(name="scheduler.expression", value="3 0 * * * ?"), @Property(name="scheduler.concurrent", boolValue=false)})
> public class DatastorePeriodicGC implements Runnable {
> 
> See: I'm trying to use the @Service value of org.quartz.Job.class rather than java.lang.Runnable.class. Runnable works fine for me but I want to try to use org.quartz.Job just because I want to implement everything using the new classes.
> 
> So my first question is, where does org.quartz.* come from? I've look through the declarations of the event bundles and I don't see it anywhere. Do I have to bundle it myself? I'm getting import errors.
> 
> (lesser importance, will the scheduler.expression run every 3 am?)
> 
> Rob
> 
>