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/24 19:09:35 UTC

trying to implement the new job system

Hi,

I'm trying to implement the new job system using a recent sling build. org.apache.sling.event is at 3.3.1-SNAPSHOT. (updated this morning)

What I'm doing is very similar to the example at the sling website. And I can see my events being created under the /var/eventing/jobs/unassigned node, so creating the events seems to be working, but my consumer just isn't consuming them.

Here's how I create them:

jobManager.addJob(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED, DatastoreGCService.DATASTORE_GC_REQUESTED_JOB_PROPERTIES);

TOPIC_DATASTORE_GC_REQUESTED = "com/astracorp/core/datastore/gc/requested";
DATASTORE_GC_REQUESTED_JOB_PROPERTIES = new HashMap<String,Object>();


Here's what my consumer looks like:

@Component(enabled = true, immediate = true, metatype = true)
@Service(value = JobConsumer.class)
@Property(name = JobConsumer.PROPERTY_TOPICS, value = {DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED})
public class DatastoreGCHandler implements JobConsumer {
    public static final Logger LOGGER = LoggerFactory.getLogger(DatastoreGCHandler.class);

    @Override
    public JobResult process(final Job job) {
        LOGGER.debug("process job called");
        return null;
    }
}


The consumer is listed in the services as:
[org.apache.sling.event.jobs.consumer.JobConsumer]
component.id	136
component.name	com.astracorp.engine.commons.handlers.DatastoreGCHandler
job.topics	com/astracorp/core/datastore/gc/requested
Service PID	com.astracorp.engine.commons.handlers.DatastoreGCHandler



Everything looks fine to me but it's just not consuming. Am I missing something? I notice that some components are not running, but I'm not sure which is required.

org.apache.sling.event.impl.jobs.deprecated.JobStatusProviderImpl : registered
org.apache.sling.event.impl.jobs.tasks.HistoryCleanUpTask : registered
org.apache.sling.event.jobs.QueueConfiguration : unsatisfied  (probably needs a config)


Rob


Re: trying to implement the new job system

Posted by Robert Munteanu <ro...@apache.org>.
FYI, org.apache.felix.scr 1.8.0 was released and we've included it in
the Sling launchpad as well.

Robert

On Sun, Oct 27, 2013 at 9:17 PM, Robert A. Decker <de...@robdecker.com> wrote:
> Even with changing the pom/pom.xml for Felix I'm having trouble building the felix trunk. I don't want to take the time to debug felix.
>
> I'm going to put my sling dev hold for awhile until sling is working. I'll monitor the sling trunk for updates.
>
> Rob
>
>
> On Oct 27, 2013, at 3:57 PM, Carsten Ziegeler wrote:
>
>> It seems current trunk in Apache Felix is broken, you can use
>> 1.5.0-SNAPSHOT it's the same as 1.4.0
>>
>> Carsten
>>
>>
>> 2013/10/27 Robert A. Decker <de...@robdecker.com>
>>
>>> I'm trying to build felix trunk but it requires
>>> org.apache.felix:org.apache.felix.utils:jar:1.4.0 which doesn't exist in
>>> any of the usual places, and isn't downloadable from the felix website. The
>>> newest I can find anywhere is 1.2.0, and building felix builds
>>> 1.5.0-SNAPSHOT.
>>>
>>> Can someone send org.apache.felix:org.apache.felix.utils:jar:1.4.0 to me?
>>> I'll install manually into my archiva server.
>>>
>>> Rob
>>>
>>> On Oct 27, 2013, at 1:10 PM, Carsten Ziegeler wrote:
>>>
>>>> Ah, right, thanks Robert - I've reverted back to 1.6.0
>>>>
>>>> So, if you want to get the Job Handling running for now you have to use
>>> a
>>>> SCR version from Apache Felix trunk. A 1.8.0 release will be pretty soon
>>>>
>>>> Carsten
>>>>
>>>>
>>>> 2013/10/27 Robert Munteanu <ro...@lmn.ro>
>>>>
>>>>> On Sun, Oct 27, 2013 at 1:01 PM, Carsten Ziegeler <cziegeler@apache.org
>>>>
>>>>> wrote:
>>>>>> I'Ve now updated
>>>>>> Sling's launchpad to use SCR 1.6.2 and your bundle/jobs run fine with
>>> it
>>>>>
>>>>>
>>>>> Hm, SCR 1.6.2 caused problems with the SlingPostServlet. IIRC
>>>>> SlingPostOperation instances registered in the activate method were
>>>>> never bound. So SCR 1.6.2 is a no-go from that perspective.
>>>>>
>>>>> See https://issues.apache.org/jira/browse/SLING-2888 for more details.
>>>>>
>>>>> Robert
>>>>>
>>>>> --
>>>>> Sent from my (old) computer
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Carsten Ziegeler
>>>> cziegeler@apache.org
>>>
>>>
>>
>>
>> --
>> Carsten Ziegeler
>> cziegeler@apache.org
>

Re: trying to implement the new job system

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Mon, Oct 28, 2013 at 10:18 AM, Robert Munteanu <ro...@lmn.ro> wrote:
> ...since
>
> a) Jenkins generates so much noise with false problems and
> b) we have some flaky tests
>
> real failures don't get many people's attention....

Not a good excuse to avoid writing tests.

Our extensive integration tests suite has helped us catch many
problems so far, let's not lose this.

-Bertrand

Re: trying to implement the new job system

Posted by Robert Munteanu <ro...@lmn.ro>.
On Mon, Oct 28, 2013 at 10:35 AM, Bertrand Delacretaz
<bd...@apache.org> wrote:
> On Mon, Oct 28, 2013 at 7:39 AM, Carsten Ziegeler <cz...@apache.org> wrote:
>> ...Fair enough, sorry for the confusion - if you just want to test the job
>> stuff, then version 1.6.2 works - however in that case other things like
>> the post servlet do not work....
>
> Does anyone know why our integration tests don't catch this?
>
> I'll happily add a few tests there if someone can point me in the
> right direction (or beat me to adding those tests ;-)

IIRC the ITs catch this situation - can't say right now which ones .

However, since

a) Jenkins generates so much noise with false problems and
b) we have some flaky tests

real failures don't get many people's attention.

Robert

>
> -Bertrand



-- 
Sent from my (old) computer

Re: trying to implement the new job system

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Mon, Oct 28, 2013 at 7:39 AM, Carsten Ziegeler <cz...@apache.org> wrote:
> ...Fair enough, sorry for the confusion - if you just want to test the job
> stuff, then version 1.6.2 works - however in that case other things like
> the post servlet do not work....

Does anyone know why our integration tests don't catch this?

I'll happily add a few tests there if someone can point me in the
right direction (or beat me to adding those tests ;-)

-Bertrand

Re: trying to implement the new job system

Posted by Carsten Ziegeler <cz...@apache.org>.
Fair enough, sorry for the confusion - if you just want to test the job
stuff, then version 1.6.2 works - however in that case other things like
the post servlet do not work.

Carsten


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

> Even with changing the pom/pom.xml for Felix I'm having trouble building
> the felix trunk. I don't want to take the time to debug felix.
>
> I'm going to put my sling dev hold for awhile until sling is working. I'll
> monitor the sling trunk for updates.
>
> Rob
>
>
> On Oct 27, 2013, at 3:57 PM, Carsten Ziegeler wrote:
>
> > It seems current trunk in Apache Felix is broken, you can use
> > 1.5.0-SNAPSHOT it's the same as 1.4.0
> >
> > Carsten
> >
> >
> > 2013/10/27 Robert A. Decker <de...@robdecker.com>
> >
> >> I'm trying to build felix trunk but it requires
> >> org.apache.felix:org.apache.felix.utils:jar:1.4.0 which doesn't exist in
> >> any of the usual places, and isn't downloadable from the felix website.
> The
> >> newest I can find anywhere is 1.2.0, and building felix builds
> >> 1.5.0-SNAPSHOT.
> >>
> >> Can someone send org.apache.felix:org.apache.felix.utils:jar:1.4.0 to
> me?
> >> I'll install manually into my archiva server.
> >>
> >> Rob
> >>
> >> On Oct 27, 2013, at 1:10 PM, Carsten Ziegeler wrote:
> >>
> >>> Ah, right, thanks Robert - I've reverted back to 1.6.0
> >>>
> >>> So, if you want to get the Job Handling running for now you have to use
> >> a
> >>> SCR version from Apache Felix trunk. A 1.8.0 release will be pretty
> soon
> >>>
> >>> Carsten
> >>>
> >>>
> >>> 2013/10/27 Robert Munteanu <ro...@lmn.ro>
> >>>
> >>>> On Sun, Oct 27, 2013 at 1:01 PM, Carsten Ziegeler <
> cziegeler@apache.org
> >>>
> >>>> wrote:
> >>>>> I'Ve now updated
> >>>>> Sling's launchpad to use SCR 1.6.2 and your bundle/jobs run fine with
> >> it
> >>>>
> >>>>
> >>>> Hm, SCR 1.6.2 caused problems with the SlingPostServlet. IIRC
> >>>> SlingPostOperation instances registered in the activate method were
> >>>> never bound. So SCR 1.6.2 is a no-go from that perspective.
> >>>>
> >>>> See https://issues.apache.org/jira/browse/SLING-2888 for more
> details.
> >>>>
> >>>> Robert
> >>>>
> >>>> --
> >>>> Sent from my (old) computer
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Carsten Ziegeler
> >>> cziegeler@apache.org
> >>
> >>
> >
> >
> > --
> > Carsten Ziegeler
> > cziegeler@apache.org
>
>


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: trying to implement the new job system

Posted by "Robert A. Decker" <de...@robdecker.com>.
Even with changing the pom/pom.xml for Felix I'm having trouble building the felix trunk. I don't want to take the time to debug felix.

I'm going to put my sling dev hold for awhile until sling is working. I'll monitor the sling trunk for updates.

Rob


On Oct 27, 2013, at 3:57 PM, Carsten Ziegeler wrote:

> It seems current trunk in Apache Felix is broken, you can use
> 1.5.0-SNAPSHOT it's the same as 1.4.0
> 
> Carsten
> 
> 
> 2013/10/27 Robert A. Decker <de...@robdecker.com>
> 
>> I'm trying to build felix trunk but it requires
>> org.apache.felix:org.apache.felix.utils:jar:1.4.0 which doesn't exist in
>> any of the usual places, and isn't downloadable from the felix website. The
>> newest I can find anywhere is 1.2.0, and building felix builds
>> 1.5.0-SNAPSHOT.
>> 
>> Can someone send org.apache.felix:org.apache.felix.utils:jar:1.4.0 to me?
>> I'll install manually into my archiva server.
>> 
>> Rob
>> 
>> On Oct 27, 2013, at 1:10 PM, Carsten Ziegeler wrote:
>> 
>>> Ah, right, thanks Robert - I've reverted back to 1.6.0
>>> 
>>> So, if you want to get the Job Handling running for now you have to use
>> a
>>> SCR version from Apache Felix trunk. A 1.8.0 release will be pretty soon
>>> 
>>> Carsten
>>> 
>>> 
>>> 2013/10/27 Robert Munteanu <ro...@lmn.ro>
>>> 
>>>> On Sun, Oct 27, 2013 at 1:01 PM, Carsten Ziegeler <cziegeler@apache.org
>>> 
>>>> wrote:
>>>>> I'Ve now updated
>>>>> Sling's launchpad to use SCR 1.6.2 and your bundle/jobs run fine with
>> it
>>>> 
>>>> 
>>>> Hm, SCR 1.6.2 caused problems with the SlingPostServlet. IIRC
>>>> SlingPostOperation instances registered in the activate method were
>>>> never bound. So SCR 1.6.2 is a no-go from that perspective.
>>>> 
>>>> See https://issues.apache.org/jira/browse/SLING-2888 for more details.
>>>> 
>>>> Robert
>>>> 
>>>> --
>>>> Sent from my (old) computer
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Carsten Ziegeler
>>> cziegeler@apache.org
>> 
>> 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org


Re: trying to implement the new job system

Posted by Carsten Ziegeler <cz...@apache.org>.
It seems current trunk in Apache Felix is broken, you can use
1.5.0-SNAPSHOT it's the same as 1.4.0

Carsten


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

> I'm trying to build felix trunk but it requires
> org.apache.felix:org.apache.felix.utils:jar:1.4.0 which doesn't exist in
> any of the usual places, and isn't downloadable from the felix website. The
> newest I can find anywhere is 1.2.0, and building felix builds
> 1.5.0-SNAPSHOT.
>
> Can someone send org.apache.felix:org.apache.felix.utils:jar:1.4.0 to me?
> I'll install manually into my archiva server.
>
> Rob
>
> On Oct 27, 2013, at 1:10 PM, Carsten Ziegeler wrote:
>
> > Ah, right, thanks Robert - I've reverted back to 1.6.0
> >
> > So, if you want to get the Job Handling running for now you have to use
>  a
> > SCR version from Apache Felix trunk. A 1.8.0 release will be pretty soon
> >
> > Carsten
> >
> >
> > 2013/10/27 Robert Munteanu <ro...@lmn.ro>
> >
> >> On Sun, Oct 27, 2013 at 1:01 PM, Carsten Ziegeler <cziegeler@apache.org
> >
> >> wrote:
> >>> I'Ve now updated
> >>> Sling's launchpad to use SCR 1.6.2 and your bundle/jobs run fine with
> it
> >>
> >>
> >> Hm, SCR 1.6.2 caused problems with the SlingPostServlet. IIRC
> >> SlingPostOperation instances registered in the activate method were
> >> never bound. So SCR 1.6.2 is a no-go from that perspective.
> >>
> >> See https://issues.apache.org/jira/browse/SLING-2888 for more details.
> >>
> >> Robert
> >>
> >> --
> >> Sent from my (old) computer
> >>
> >
> >
> >
> > --
> > Carsten Ziegeler
> > cziegeler@apache.org
>
>


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: trying to implement the new job system

Posted by "Robert A. Decker" <de...@robdecker.com>.
I'm trying to build felix trunk but it requires org.apache.felix:org.apache.felix.utils:jar:1.4.0 which doesn't exist in any of the usual places, and isn't downloadable from the felix website. The newest I can find anywhere is 1.2.0, and building felix builds 1.5.0-SNAPSHOT.

Can someone send org.apache.felix:org.apache.felix.utils:jar:1.4.0 to me? I'll install manually into my archiva server.

Rob

On Oct 27, 2013, at 1:10 PM, Carsten Ziegeler wrote:

> Ah, right, thanks Robert - I've reverted back to 1.6.0
> 
> So, if you want to get the Job Handling running for now you have to use  a
> SCR version from Apache Felix trunk. A 1.8.0 release will be pretty soon
> 
> Carsten
> 
> 
> 2013/10/27 Robert Munteanu <ro...@lmn.ro>
> 
>> On Sun, Oct 27, 2013 at 1:01 PM, Carsten Ziegeler <cz...@apache.org>
>> wrote:
>>> I'Ve now updated
>>> Sling's launchpad to use SCR 1.6.2 and your bundle/jobs run fine with it
>> 
>> 
>> Hm, SCR 1.6.2 caused problems with the SlingPostServlet. IIRC
>> SlingPostOperation instances registered in the activate method were
>> never bound. So SCR 1.6.2 is a no-go from that perspective.
>> 
>> See https://issues.apache.org/jira/browse/SLING-2888 for more details.
>> 
>> Robert
>> 
>> --
>> Sent from my (old) computer
>> 
> 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org


Re: trying to implement the new job system

Posted by Carsten Ziegeler <cz...@apache.org>.
Ah, right, thanks Robert - I've reverted back to 1.6.0

So, if you want to get the Job Handling running for now you have to use  a
SCR version from Apache Felix trunk. A 1.8.0 release will be pretty soon

Carsten


2013/10/27 Robert Munteanu <ro...@lmn.ro>

> On Sun, Oct 27, 2013 at 1:01 PM, Carsten Ziegeler <cz...@apache.org>
> wrote:
> > I'Ve now updated
> > Sling's launchpad to use SCR 1.6.2 and your bundle/jobs run fine with it
>
>
> Hm, SCR 1.6.2 caused problems with the SlingPostServlet. IIRC
> SlingPostOperation instances registered in the activate method were
> never bound. So SCR 1.6.2 is a no-go from that perspective.
>
> See https://issues.apache.org/jira/browse/SLING-2888 for more details.
>
> Robert
>
> --
> Sent from my (old) computer
>



-- 
Carsten Ziegeler
cziegeler@apache.org

Re: trying to implement the new job system

Posted by Robert Munteanu <ro...@lmn.ro>.
On Sun, Oct 27, 2013 at 1:01 PM, Carsten Ziegeler <cz...@apache.org> wrote:
> I'Ve now updated
> Sling's launchpad to use SCR 1.6.2 and your bundle/jobs run fine with it


Hm, SCR 1.6.2 caused problems with the SlingPostServlet. IIRC
SlingPostOperation instances registered in the activate method were
never bound. So SCR 1.6.2 is a no-go from that perspective.

See https://issues.apache.org/jira/browse/SLING-2888 for more details.

Robert

-- 
Sent from my (old) computer

Re: trying to implement the new job system

Posted by Carsten Ziegeler <cz...@apache.org>.
Thanks for the bundle - I could track it down to an old scr implementation
used which doesn't support the new topology bundle. I'Ve now updated
Sling's launchpad to use SCR 1.6.2 and your bundle/jobs run fine with it

Regards
Carsten


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

> Here you go… Thanks.
>
> DatastorePeriodicGC runs every 25 seconds and creates a job that should be
> handled by DatastoreGCHandler.
>
> I've connected the debugger to my sling instance and I've confirmed that
> DatastoreGCHandler (the JobConsumer) is being created and held by the
> JobConsumerManager. It's just not being called though for the job I'm
> creating.
>
> You can build and install on port 8080 with:
> mvn clean install -P autoInstallBundle
>
> or just install the included bundle.
>
> Rob
>
>
>
>
>
> On Oct 26, 2013, at 5:09 PM, Carsten Ziegeler wrote:
>
> > Hi,
> >
> > unassigned means there is currently no job consumer for the job - its
> hard
> > to tell why this is happening in your case. If you could create a simple
> > test bundle maybe we could see what's going (wr)on(g).
> >
> > Carsten
> >
> >
> > 2013/10/26 Robert A. Decker <de...@robdecker.com>
> >
> >> And if 'unassigned' means that the job isn't necessarily local, then I'm
> >> lost. I can't see how my job will be run.
> >>
> >> Rob
> >>
> >> On Oct 26, 2013, at 4:30 PM, Robert A. Decker wrote:
> >>
> >>> A little bit more… I understand what 'unassigned' means now - it means
> >> I'm not giving the job a queue, which I think is ok.
> >>>
> >>> So, assuming 'assigned' and 'unassigned' jobs are local, then I think
> >> the variable JobManagerConfiguration.localJobsPath is wrong since it
> only
> >> has /var/eventing/jobs/assigned/... and there needs to be one for
> >> unassigned too.
> >>>
> >>> and so the method:
> >>> public boolean isLocalJob(final String jobPath) {
> >>>       return jobPath.startsWith(this.localJobsPathWithSlash);
> >>>   }
> >>>
> >>> can then evaluate to 'true' when the path has either 'assigned' or
> >> 'unassigned'..
> >>>
> >>> Rob
> >>>
> >>>
> >>> On Oct 26, 2013, at 4:19 PM, Robert A. Decker wrote:
> >>>
> >>>> I'm trying to figure out why my jobs aren't being consumed. Here's one
> >> thing I found.
> >>>>
> >>>> In JobManagerImpl.java, handleEvent method:
> >>>>
> >>>>  public void handleEvent(final Event event) {
> >>>>      if ( SlingConstants.TOPIC_RESOURCE_ADDED.equals(event.getTopic())
> >> ) {
> >>>>          final String path = (String)
> >> event.getProperty(SlingConstants.PROPERTY_PATH);
> >>>>          final String rt = (String)
> >> event.getProperty(SlingConstants.PROPERTY_RESOURCE_TYPE);
> >>>>          if ( (rt == null ||
> >> ResourceHelper.RESOURCE_TYPE_JOB.equals(rt)) &&
> >>>>               this.configuration.isLocalJob(path) ) {
> >>>>              synchronized ( this.directlyAddedPaths ) {
> >>>>                  if ( directlyAddedPaths.remove(path) ) {
> >>>>                      return;
> >>>>                  }
> >>>>              }
> >>>>              this.backgroundLoader.loadJob(path);
> >>>>          }
> >>>>          this.jobScheduler.handleEvent(event);
> >>>>      } else if ( Utility.TOPIC_STOP.equals(event.getTopic()) ) {
> >>>>
> >>>>
> >>>> this.configuration.isLocalJob(path) evaluates as false and so my job
> is
> >> not added to the backgroundLoader, but instead gets sent to the
> scheduler.
> >> But because this is not a scheduled job type it isn't added to the
> queue by
> >> the jobScheduler.
> >>>>              if ( path != null &&
> >> path.startsWith(this.config.getScheduledJobsPathWithSlash())
> >>>>                   && (resourceType == null ||
> >> ResourceHelper.RESOURCE_TYPE_SCHEDULED_JOB.equals(resourceType))) {
> >>>>
> >>>> For the JobManagerConfiguration.isLocalJob method:
> >>>>  public boolean isLocalJob(final String jobPath) {
> >>>>      return jobPath.startsWith(this.localJobsPathWithSlash);
> >>>>  }
> >>>>
> >>>> my
> >>
> jobPath=/var/eventing/jobs/unassigned/com.astracorp.core.datastore.gc.requested/2013/10/26/16/16/com.astracorp.core.datastore.gc.requested_622b9d5e-e949-490e-88b6-71e6498802a7_32
> >>>> and
> >>
> JobManagerConfiguration.localJobsPathWithSlash=/var/eventing/jobs/assigned/622b9d5e-e949-490e-88b6-71e6498802a7/
> >>>>
> >>>>
> >>>> Any ideas? What's the difference between /var/eventing/jobs/unassigned
> >> and /var/eventing/jobs/assigned?
> >>>>
> >>>>
> >>>> Rob
> >>>>
> >>>>
> >>>>
> >>>> On Oct 25, 2013, at 9:24 AM, Carsten Ziegeler wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> the JobConsumerManager is not public api and therefore not available
> >> to other bundles.
> >>>>> Looking at your example from the first post, it looks ok to me - it
> >> should work without a specific queue configuration as the main queue is
> >> always available.
> >>>>> However your job consumer implementation shouldn't return null but a
> >> result.
> >>>>>
> >>>>> Carsten
> >>>>>
> >>>>>
> >>>>> 2013/10/25 Robert A. Decker <de...@robdecker.com>
> >>>>> I think I'm having a maven dependency problem, but I'm just not
> sure...
> >>>>>
> >>>>> Here's what my org.apache.sling.event bundle looks like:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> Here's how I declare the dependency:
> >>>>>          <dependency>
> >>>>>              <groupId>org.apache.sling</groupId>
> >>>>>              <artifactId>org.apache.sling.event</artifactId>
> >>>>>              <version>3.3.1-SNAPSHOT</version>
> >>>>>              <scope>provided</scope>
> >>>>>          </dependency>
> >>>>>
> >>>>>
> >>>>>
> >>>>> As an experiment/debugging, when I try to call the jobConsumerManager
> >> service directly like:
> >>>>>
> >>>>>  @Reference
> >>>>>  private JobConsumerManager jobConsumerManager = null;
> >>>>>
> >>>>>      LOGGER.debug("executor:" +
> >>
> jobConsumerManager.getExecutor(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED));
> >>>>>      LOGGER.debug("topics:" + jobConsumerManager.getTopics());
> >>>>>
> >>>>> I get class not found errors:
> >>>>>
> >>>>> 25│Caused by: java.lang.ClassNotFoundException:
> >> org.apache.sling.event.impl.jobs.JobConsumerManager not found by
> astra-core
> >> [103]
> │te
> >>>>> d │    at
> >>
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1500)
> >> ~[na:na].in
> >>      │
> >>>>> 25│    at
> >>
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
> >> ~[na:na].:1
> >>                             │
> >>>>> 25│    at
> >>
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1923)
> >> ~[na:na].ch
> >>          │
> >>>>> 25│    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> >> ~[na:1.7.0_40].:
> >>                                                         │
> >>>>> 25│    ... 34 common frames omitted...
> >>
> >>                                                 │
> >>>>> 25│25.10.2013 00:27:11.102 *ERROR* [FelixFrameworkWiring] astra-core
> >> [com.astracorp.engine.commons.schedulers.DatastorePeriodicGC] Cannot
> >> register Component (java.lang.NoClassDefFoundError: org/ap│
> >>>>> 25│ache/sling/event/impl/jobs/JobConsumerManager)
> >>
> >>                                                  │
> >>>>> 25│java.lang.NoClassDefFoundError:
> >> org/apache/sling/event/impl/jobs/JobConsumerManager
> >>
> >>         │
> >>>>> 25│    at java.lang.Class.getDeclaredMethods0(Native Method)
> >> ~[na:1.7.0_40].cr
> >>                                                           │
> >>>>> 25│    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
> >> ~[na:1.7.0_40].ac
> >>                                                   │ch
> >>>>> e.│    at java.lang.Class.getDeclaredMethods(Class.java:1845)
> >> ~[na:1.7.0_40].nd
> >>                                                          │ef
> >>>>> au│    at
> >>
> org.apache.felix.scr.impl.helper.BindMethod.getServiceObjectAssignableMethod(BindMethod.java:389)
> >> ~[org.apache.felix.scr-1.6.0.jar:na].Ba
> >>            │
> >>>>>
> >>>>>
> >>>>>
> >>>>> I've tried changing the scope to compile, I've tried moving back
> >> version numbers, and nothing seems to work.
> >>>>>
> >>>>> Any ideas?
> >>>>>
> >>>>>
> >>>>> Rob
> >>>>>
> >>>>> On Oct 24, 2013, at 7:09 PM, Robert A. Decker wrote:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> I'm trying to implement the new job system using a recent sling
> >> build. org.apache.sling.event is at 3.3.1-SNAPSHOT. (updated this
> morning)
> >>>>>>
> >>>>>> What I'm doing is very similar to the example at the sling website.
> >> And I can see my events being created under the
> >> /var/eventing/jobs/unassigned node, so creating the events seems to be
> >> working, but my consumer just isn't consuming them.
> >>>>>>
> >>>>>> Here's how I create them:
> >>>>>>
> >>>>>> jobManager.addJob(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED,
> >> DatastoreGCService.DATASTORE_GC_REQUESTED_JOB_PROPERTIES);
> >>>>>>
> >>>>>> TOPIC_DATASTORE_GC_REQUESTED =
> >> "com/astracorp/core/datastore/gc/requested";
> >>>>>> DATASTORE_GC_REQUESTED_JOB_PROPERTIES = new
> HashMap<String,Object>();
> >>>>>>
> >>>>>>
> >>>>>> Here's what my consumer looks like:
> >>>>>>
> >>>>>> @Component(enabled = true, immediate = true, metatype = true)
> >>>>>> @Service(value = JobConsumer.class)
> >>>>>> @Property(name = JobConsumer.PROPERTY_TOPICS, value =
> >> {DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED})
> >>>>>> public class DatastoreGCHandler implements JobConsumer {
> >>>>>> public static final Logger LOGGER =
> >> LoggerFactory.getLogger(DatastoreGCHandler.class);
> >>>>>>
> >>>>>> @Override
> >>>>>> public JobResult process(final Job job) {
> >>>>>>     LOGGER.debug("process job called");
> >>>>>>     return null;
> >>>>>> }
> >>>>>> }
> >>>>>>
> >>>>>>
> >>>>>> The consumer is listed in the services as:
> >>>>>> [org.apache.sling.event.jobs.consumer.JobConsumer]
> >>>>>> component.id       136
> >>>>>> component.name
> >> com.astracorp.engine.commons.handlers.DatastoreGCHandler
> >>>>>> job.topics com/astracorp/core/datastore/gc/requested
> >>>>>> Service PID
> >> com.astracorp.engine.commons.handlers.DatastoreGCHandler
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> Everything looks fine to me but it's just not consuming. Am I
> missing
> >> something? I notice that some components are not running, but I'm not
> sure
> >> which is required.
> >>>>>>
> >>>>>> org.apache.sling.event.impl.jobs.deprecated.JobStatusProviderImpl :
> >> registered
> >>>>>> org.apache.sling.event.impl.jobs.tasks.HistoryCleanUpTask :
> registered
> >>>>>> org.apache.sling.event.jobs.QueueConfiguration : unsatisfied
> >> (probably needs a config)
> >>>>>>
> >>>>>>
> >>>>>> Rob
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> Carsten Ziegeler
> >>>>> cziegeler@apache.org
> >>>>
> >>>>
> >>>
> >>
> >>
> >
> >
> > --
> > Carsten Ziegeler
> > cziegeler@apache.org
>
>
>


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: trying to implement the new job system

Posted by "Robert A. Decker" <de...@robdecker.com>.
Here you go… Thanks.

DatastorePeriodicGC runs every 25 seconds and creates a job that should be handled by DatastoreGCHandler.

I've connected the debugger to my sling instance and I've confirmed that DatastoreGCHandler (the JobConsumer) is being created and held by the JobConsumerManager. It's just not being called though for the job I'm creating.

You can build and install on port 8080 with:
mvn clean install -P autoInstallBundle

or just install the included bundle.

Rob


Re: trying to implement the new job system

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

unassigned means there is currently no job consumer for the job - its hard
to tell why this is happening in your case. If you could create a simple
test bundle maybe we could see what's going (wr)on(g).

Carsten


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

> And if 'unassigned' means that the job isn't necessarily local, then I'm
> lost. I can't see how my job will be run.
>
> Rob
>
> On Oct 26, 2013, at 4:30 PM, Robert A. Decker wrote:
>
> > A little bit more… I understand what 'unassigned' means now - it means
> I'm not giving the job a queue, which I think is ok.
> >
> > So, assuming 'assigned' and 'unassigned' jobs are local, then I think
> the variable JobManagerConfiguration.localJobsPath is wrong since it only
> has /var/eventing/jobs/assigned/... and there needs to be one for
> unassigned too.
> >
> > and so the method:
> > public boolean isLocalJob(final String jobPath) {
> >        return jobPath.startsWith(this.localJobsPathWithSlash);
> >    }
> >
> > can then evaluate to 'true' when the path has either 'assigned' or
> 'unassigned'..
> >
> > Rob
> >
> >
> > On Oct 26, 2013, at 4:19 PM, Robert A. Decker wrote:
> >
> >> I'm trying to figure out why my jobs aren't being consumed. Here's one
> thing I found.
> >>
> >> In JobManagerImpl.java, handleEvent method:
> >>
> >>   public void handleEvent(final Event event) {
> >>       if ( SlingConstants.TOPIC_RESOURCE_ADDED.equals(event.getTopic())
> ) {
> >>           final String path = (String)
> event.getProperty(SlingConstants.PROPERTY_PATH);
> >>           final String rt = (String)
> event.getProperty(SlingConstants.PROPERTY_RESOURCE_TYPE);
> >>           if ( (rt == null ||
> ResourceHelper.RESOURCE_TYPE_JOB.equals(rt)) &&
> >>                this.configuration.isLocalJob(path) ) {
> >>               synchronized ( this.directlyAddedPaths ) {
> >>                   if ( directlyAddedPaths.remove(path) ) {
> >>                       return;
> >>                   }
> >>               }
> >>               this.backgroundLoader.loadJob(path);
> >>           }
> >>           this.jobScheduler.handleEvent(event);
> >>       } else if ( Utility.TOPIC_STOP.equals(event.getTopic()) ) {
> >>
> >>
> >> this.configuration.isLocalJob(path) evaluates as false and so my job is
> not added to the backgroundLoader, but instead gets sent to the scheduler.
> But because this is not a scheduled job type it isn't added to the queue by
> the jobScheduler.
> >>               if ( path != null &&
> path.startsWith(this.config.getScheduledJobsPathWithSlash())
> >>                    && (resourceType == null ||
> ResourceHelper.RESOURCE_TYPE_SCHEDULED_JOB.equals(resourceType))) {
> >>
> >> For the JobManagerConfiguration.isLocalJob method:
> >>   public boolean isLocalJob(final String jobPath) {
> >>       return jobPath.startsWith(this.localJobsPathWithSlash);
> >>   }
> >>
> >> my
> jobPath=/var/eventing/jobs/unassigned/com.astracorp.core.datastore.gc.requested/2013/10/26/16/16/com.astracorp.core.datastore.gc.requested_622b9d5e-e949-490e-88b6-71e6498802a7_32
> >> and
> JobManagerConfiguration.localJobsPathWithSlash=/var/eventing/jobs/assigned/622b9d5e-e949-490e-88b6-71e6498802a7/
> >>
> >>
> >> Any ideas? What's the difference between /var/eventing/jobs/unassigned
> and /var/eventing/jobs/assigned?
> >>
> >>
> >> Rob
> >>
> >>
> >>
> >> On Oct 25, 2013, at 9:24 AM, Carsten Ziegeler wrote:
> >>
> >>> Hi,
> >>>
> >>> the JobConsumerManager is not public api and therefore not available
> to other bundles.
> >>> Looking at your example from the first post, it looks ok to me - it
> should work without a specific queue configuration as the main queue is
> always available.
> >>> However your job consumer implementation shouldn't return null but a
> result.
> >>>
> >>> Carsten
> >>>
> >>>
> >>> 2013/10/25 Robert A. Decker <de...@robdecker.com>
> >>> I think I'm having a maven dependency problem, but I'm just not sure...
> >>>
> >>> Here's what my org.apache.sling.event bundle looks like:
> >>>
> >>>
> >>>
> >>>
> >>> Here's how I declare the dependency:
> >>>           <dependency>
> >>>               <groupId>org.apache.sling</groupId>
> >>>               <artifactId>org.apache.sling.event</artifactId>
> >>>               <version>3.3.1-SNAPSHOT</version>
> >>>               <scope>provided</scope>
> >>>           </dependency>
> >>>
> >>>
> >>>
> >>> As an experiment/debugging, when I try to call the jobConsumerManager
> service directly like:
> >>>
> >>>   @Reference
> >>>   private JobConsumerManager jobConsumerManager = null;
> >>>
> >>>       LOGGER.debug("executor:" +
> jobConsumerManager.getExecutor(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED));
> >>>       LOGGER.debug("topics:" + jobConsumerManager.getTopics());
> >>>
> >>> I get class not found errors:
> >>>
> >>> 25│Caused by: java.lang.ClassNotFoundException:
> org.apache.sling.event.impl.jobs.JobConsumerManager not found by astra-core
> [103]                                                                   │te
> >>> d │    at
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1500)
> ~[na:na].in
>       │
> >>> 25│    at
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
> ~[na:na].:1
>                              │
> >>> 25│    at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1923)
> ~[na:na].ch
>           │
> >>> 25│    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ~[na:1.7.0_40].:
>                                                          │
> >>> 25│    ... 34 common frames omitted...
>
>                                                  │
> >>> 25│25.10.2013 00:27:11.102 *ERROR* [FelixFrameworkWiring] astra-core
> [com.astracorp.engine.commons.schedulers.DatastorePeriodicGC] Cannot
> register Component (java.lang.NoClassDefFoundError: org/ap│
> >>> 25│ache/sling/event/impl/jobs/JobConsumerManager)
>
>                                                   │
> >>> 25│java.lang.NoClassDefFoundError:
> org/apache/sling/event/impl/jobs/JobConsumerManager
>
>          │
> >>> 25│    at java.lang.Class.getDeclaredMethods0(Native Method)
> ~[na:1.7.0_40].cr
>                                                            │
> >>> 25│    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
> ~[na:1.7.0_40].ac
>                                                    │ch
> >>> e.│    at java.lang.Class.getDeclaredMethods(Class.java:1845)
> ~[na:1.7.0_40].nd
>                                                           │ef
> >>> au│    at
> org.apache.felix.scr.impl.helper.BindMethod.getServiceObjectAssignableMethod(BindMethod.java:389)
> ~[org.apache.felix.scr-1.6.0.jar:na].Ba
>             │
> >>>
> >>>
> >>>
> >>> I've tried changing the scope to compile, I've tried moving back
> version numbers, and nothing seems to work.
> >>>
> >>> Any ideas?
> >>>
> >>>
> >>> Rob
> >>>
> >>> On Oct 24, 2013, at 7:09 PM, Robert A. Decker wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> I'm trying to implement the new job system using a recent sling
> build. org.apache.sling.event is at 3.3.1-SNAPSHOT. (updated this morning)
> >>>>
> >>>> What I'm doing is very similar to the example at the sling website.
> And I can see my events being created under the
> /var/eventing/jobs/unassigned node, so creating the events seems to be
> working, but my consumer just isn't consuming them.
> >>>>
> >>>> Here's how I create them:
> >>>>
> >>>> jobManager.addJob(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED,
> DatastoreGCService.DATASTORE_GC_REQUESTED_JOB_PROPERTIES);
> >>>>
> >>>> TOPIC_DATASTORE_GC_REQUESTED =
> "com/astracorp/core/datastore/gc/requested";
> >>>> DATASTORE_GC_REQUESTED_JOB_PROPERTIES = new HashMap<String,Object>();
> >>>>
> >>>>
> >>>> Here's what my consumer looks like:
> >>>>
> >>>> @Component(enabled = true, immediate = true, metatype = true)
> >>>> @Service(value = JobConsumer.class)
> >>>> @Property(name = JobConsumer.PROPERTY_TOPICS, value =
> {DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED})
> >>>> public class DatastoreGCHandler implements JobConsumer {
> >>>>  public static final Logger LOGGER =
> LoggerFactory.getLogger(DatastoreGCHandler.class);
> >>>>
> >>>>  @Override
> >>>>  public JobResult process(final Job job) {
> >>>>      LOGGER.debug("process job called");
> >>>>      return null;
> >>>>  }
> >>>> }
> >>>>
> >>>>
> >>>> The consumer is listed in the services as:
> >>>> [org.apache.sling.event.jobs.consumer.JobConsumer]
> >>>> component.id       136
> >>>> component.name
> com.astracorp.engine.commons.handlers.DatastoreGCHandler
> >>>> job.topics com/astracorp/core/datastore/gc/requested
> >>>> Service PID
>  com.astracorp.engine.commons.handlers.DatastoreGCHandler
> >>>>
> >>>>
> >>>>
> >>>> Everything looks fine to me but it's just not consuming. Am I missing
> something? I notice that some components are not running, but I'm not sure
> which is required.
> >>>>
> >>>> org.apache.sling.event.impl.jobs.deprecated.JobStatusProviderImpl :
> registered
> >>>> org.apache.sling.event.impl.jobs.tasks.HistoryCleanUpTask : registered
> >>>> org.apache.sling.event.jobs.QueueConfiguration : unsatisfied
>  (probably needs a config)
> >>>>
> >>>>
> >>>> Rob
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> Carsten Ziegeler
> >>> cziegeler@apache.org
> >>
> >>
> >
>
>


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: trying to implement the new job system

Posted by "Robert A. Decker" <de...@robdecker.com>.
And if 'unassigned' means that the job isn't necessarily local, then I'm lost. I can't see how my job will be run.

Rob

On Oct 26, 2013, at 4:30 PM, Robert A. Decker wrote:

> A little bit more… I understand what 'unassigned' means now - it means I'm not giving the job a queue, which I think is ok.
> 
> So, assuming 'assigned' and 'unassigned' jobs are local, then I think the variable JobManagerConfiguration.localJobsPath is wrong since it only has /var/eventing/jobs/assigned/... and there needs to be one for unassigned too.
> 
> and so the method:
> public boolean isLocalJob(final String jobPath) {
>        return jobPath.startsWith(this.localJobsPathWithSlash);
>    }
> 
> can then evaluate to 'true' when the path has either 'assigned' or 'unassigned'..
> 
> Rob
> 
> 
> On Oct 26, 2013, at 4:19 PM, Robert A. Decker wrote:
> 
>> I'm trying to figure out why my jobs aren't being consumed. Here's one thing I found.
>> 
>> In JobManagerImpl.java, handleEvent method:
>> 
>>   public void handleEvent(final Event event) {
>>       if ( SlingConstants.TOPIC_RESOURCE_ADDED.equals(event.getTopic()) ) {
>>           final String path = (String) event.getProperty(SlingConstants.PROPERTY_PATH);
>>           final String rt = (String) event.getProperty(SlingConstants.PROPERTY_RESOURCE_TYPE);
>>           if ( (rt == null || ResourceHelper.RESOURCE_TYPE_JOB.equals(rt)) &&
>>                this.configuration.isLocalJob(path) ) {
>>               synchronized ( this.directlyAddedPaths ) {
>>                   if ( directlyAddedPaths.remove(path) ) {
>>                       return;
>>                   }
>>               }
>>               this.backgroundLoader.loadJob(path);
>>           }
>>           this.jobScheduler.handleEvent(event);
>>       } else if ( Utility.TOPIC_STOP.equals(event.getTopic()) ) {
>> 
>> 
>> this.configuration.isLocalJob(path) evaluates as false and so my job is not added to the backgroundLoader, but instead gets sent to the scheduler. But because this is not a scheduled job type it isn't added to the queue by the jobScheduler.
>>               if ( path != null && path.startsWith(this.config.getScheduledJobsPathWithSlash())
>>                    && (resourceType == null || ResourceHelper.RESOURCE_TYPE_SCHEDULED_JOB.equals(resourceType))) {
>> 
>> For the JobManagerConfiguration.isLocalJob method:
>>   public boolean isLocalJob(final String jobPath) {
>>       return jobPath.startsWith(this.localJobsPathWithSlash);
>>   }
>> 
>> my jobPath=/var/eventing/jobs/unassigned/com.astracorp.core.datastore.gc.requested/2013/10/26/16/16/com.astracorp.core.datastore.gc.requested_622b9d5e-e949-490e-88b6-71e6498802a7_32
>> and JobManagerConfiguration.localJobsPathWithSlash=/var/eventing/jobs/assigned/622b9d5e-e949-490e-88b6-71e6498802a7/
>> 
>> 
>> Any ideas? What's the difference between /var/eventing/jobs/unassigned and /var/eventing/jobs/assigned?
>> 
>> 
>> Rob
>> 
>> 
>> 
>> On Oct 25, 2013, at 9:24 AM, Carsten Ziegeler wrote:
>> 
>>> Hi,
>>> 
>>> the JobConsumerManager is not public api and therefore not available to other bundles.
>>> Looking at your example from the first post, it looks ok to me - it should work without a specific queue configuration as the main queue is always available.
>>> However your job consumer implementation shouldn't return null but a result.
>>> 
>>> Carsten
>>> 
>>> 
>>> 2013/10/25 Robert A. Decker <de...@robdecker.com>
>>> I think I'm having a maven dependency problem, but I'm just not sure...
>>> 
>>> Here's what my org.apache.sling.event bundle looks like:
>>> 
>>> 
>>> 
>>> 
>>> Here's how I declare the dependency:
>>>           <dependency>
>>>               <groupId>org.apache.sling</groupId>
>>>               <artifactId>org.apache.sling.event</artifactId>
>>>               <version>3.3.1-SNAPSHOT</version>
>>>               <scope>provided</scope>
>>>           </dependency>
>>> 
>>> 
>>> 
>>> As an experiment/debugging, when I try to call the jobConsumerManager service directly like:
>>> 
>>>   @Reference
>>>   private JobConsumerManager jobConsumerManager = null;
>>> 
>>>       LOGGER.debug("executor:" + jobConsumerManager.getExecutor(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED));
>>>       LOGGER.debug("topics:" + jobConsumerManager.getTopics());
>>> 
>>> I get class not found errors:
>>> 
>>> 25│Caused by: java.lang.ClassNotFoundException: org.apache.sling.event.impl.jobs.JobConsumerManager not found by astra-core [103]                                                                   │te
>>> d │    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1500) ~[na:na].in                                                                       │
>>> 25│    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) ~[na:na].:1                                                                                              │
>>> 25│    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1923) ~[na:na].ch                                                                           │
>>> 25│    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.7.0_40].:                                                                                                                    │
>>> 25│    ... 34 common frames omitted...                                                                                                                                                              │
>>> 25│25.10.2013 00:27:11.102 *ERROR* [FelixFrameworkWiring] astra-core [com.astracorp.engine.commons.schedulers.DatastorePeriodicGC] Cannot register Component (java.lang.NoClassDefFoundError: org/ap│
>>> 25│ache/sling/event/impl/jobs/JobConsumerManager)                                                                                                                                                   │
>>> 25│java.lang.NoClassDefFoundError: org/apache/sling/event/impl/jobs/JobConsumerManager                                                                                                              │
>>> 25│    at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.7.0_40].cr                                                                                                                      │
>>> 25│    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521) ~[na:1.7.0_40].ac                                                                                                              │ch
>>> e.│    at java.lang.Class.getDeclaredMethods(Class.java:1845) ~[na:1.7.0_40].nd                                                                                                                     │ef
>>> au│    at org.apache.felix.scr.impl.helper.BindMethod.getServiceObjectAssignableMethod(BindMethod.java:389) ~[org.apache.felix.scr-1.6.0.jar:na].Ba                                                 │
>>> 
>>> 
>>> 
>>> I've tried changing the scope to compile, I've tried moving back version numbers, and nothing seems to work.
>>> 
>>> Any ideas?
>>> 
>>> 
>>> Rob
>>> 
>>> On Oct 24, 2013, at 7:09 PM, Robert A. Decker wrote:
>>> 
>>>> Hi,
>>>> 
>>>> I'm trying to implement the new job system using a recent sling build. org.apache.sling.event is at 3.3.1-SNAPSHOT. (updated this morning)
>>>> 
>>>> What I'm doing is very similar to the example at the sling website. And I can see my events being created under the /var/eventing/jobs/unassigned node, so creating the events seems to be working, but my consumer just isn't consuming them.
>>>> 
>>>> Here's how I create them:
>>>> 
>>>> jobManager.addJob(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED, DatastoreGCService.DATASTORE_GC_REQUESTED_JOB_PROPERTIES);
>>>> 
>>>> TOPIC_DATASTORE_GC_REQUESTED = "com/astracorp/core/datastore/gc/requested";
>>>> DATASTORE_GC_REQUESTED_JOB_PROPERTIES = new HashMap<String,Object>();
>>>> 
>>>> 
>>>> Here's what my consumer looks like:
>>>> 
>>>> @Component(enabled = true, immediate = true, metatype = true)
>>>> @Service(value = JobConsumer.class)
>>>> @Property(name = JobConsumer.PROPERTY_TOPICS, value = {DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED})
>>>> public class DatastoreGCHandler implements JobConsumer {
>>>>  public static final Logger LOGGER = LoggerFactory.getLogger(DatastoreGCHandler.class);
>>>> 
>>>>  @Override
>>>>  public JobResult process(final Job job) {
>>>>      LOGGER.debug("process job called");
>>>>      return null;
>>>>  }
>>>> }
>>>> 
>>>> 
>>>> The consumer is listed in the services as:
>>>> [org.apache.sling.event.jobs.consumer.JobConsumer]
>>>> component.id	136
>>>> component.name	com.astracorp.engine.commons.handlers.DatastoreGCHandler
>>>> job.topics	com/astracorp/core/datastore/gc/requested
>>>> Service PID	com.astracorp.engine.commons.handlers.DatastoreGCHandler
>>>> 
>>>> 
>>>> 
>>>> Everything looks fine to me but it's just not consuming. Am I missing something? I notice that some components are not running, but I'm not sure which is required.
>>>> 
>>>> org.apache.sling.event.impl.jobs.deprecated.JobStatusProviderImpl : registered
>>>> org.apache.sling.event.impl.jobs.tasks.HistoryCleanUpTask : registered
>>>> org.apache.sling.event.jobs.QueueConfiguration : unsatisfied  (probably needs a config)
>>>> 
>>>> 
>>>> Rob
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Carsten Ziegeler
>>> cziegeler@apache.org
>> 
>> 
> 


Re: trying to implement the new job system

Posted by "Robert A. Decker" <de...@robdecker.com>.
A little bit more… I understand what 'unassigned' means now - it means I'm not giving the job a queue, which I think is ok.

So, assuming 'assigned' and 'unassigned' jobs are local, then I think the variable JobManagerConfiguration.localJobsPath is wrong since it only has /var/eventing/jobs/assigned/... and there needs to be one for unassigned too.

and so the method:
public boolean isLocalJob(final String jobPath) {
        return jobPath.startsWith(this.localJobsPathWithSlash);
    }

can then evaluate to 'true' when the path has either 'assigned' or 'unassigned'..

Rob


On Oct 26, 2013, at 4:19 PM, Robert A. Decker wrote:

> I'm trying to figure out why my jobs aren't being consumed. Here's one thing I found.
> 
> In JobManagerImpl.java, handleEvent method:
> 
>    public void handleEvent(final Event event) {
>        if ( SlingConstants.TOPIC_RESOURCE_ADDED.equals(event.getTopic()) ) {
>            final String path = (String) event.getProperty(SlingConstants.PROPERTY_PATH);
>            final String rt = (String) event.getProperty(SlingConstants.PROPERTY_RESOURCE_TYPE);
>            if ( (rt == null || ResourceHelper.RESOURCE_TYPE_JOB.equals(rt)) &&
>                 this.configuration.isLocalJob(path) ) {
>                synchronized ( this.directlyAddedPaths ) {
>                    if ( directlyAddedPaths.remove(path) ) {
>                        return;
>                    }
>                }
>                this.backgroundLoader.loadJob(path);
>            }
>            this.jobScheduler.handleEvent(event);
>        } else if ( Utility.TOPIC_STOP.equals(event.getTopic()) ) {
> 
> 
> this.configuration.isLocalJob(path) evaluates as false and so my job is not added to the backgroundLoader, but instead gets sent to the scheduler. But because this is not a scheduled job type it isn't added to the queue by the jobScheduler.
>                if ( path != null && path.startsWith(this.config.getScheduledJobsPathWithSlash())
>                     && (resourceType == null || ResourceHelper.RESOURCE_TYPE_SCHEDULED_JOB.equals(resourceType))) {
> 
> For the JobManagerConfiguration.isLocalJob method:
>    public boolean isLocalJob(final String jobPath) {
>        return jobPath.startsWith(this.localJobsPathWithSlash);
>    }
> 
> my jobPath=/var/eventing/jobs/unassigned/com.astracorp.core.datastore.gc.requested/2013/10/26/16/16/com.astracorp.core.datastore.gc.requested_622b9d5e-e949-490e-88b6-71e6498802a7_32
> and JobManagerConfiguration.localJobsPathWithSlash=/var/eventing/jobs/assigned/622b9d5e-e949-490e-88b6-71e6498802a7/
> 
> 
> Any ideas? What's the difference between /var/eventing/jobs/unassigned and /var/eventing/jobs/assigned?
> 
> 
> Rob
> 
> 
> 
> On Oct 25, 2013, at 9:24 AM, Carsten Ziegeler wrote:
> 
>> Hi,
>> 
>> the JobConsumerManager is not public api and therefore not available to other bundles.
>> Looking at your example from the first post, it looks ok to me - it should work without a specific queue configuration as the main queue is always available.
>> However your job consumer implementation shouldn't return null but a result.
>> 
>> Carsten
>> 
>> 
>> 2013/10/25 Robert A. Decker <de...@robdecker.com>
>> I think I'm having a maven dependency problem, but I'm just not sure...
>> 
>> Here's what my org.apache.sling.event bundle looks like:
>> 
>> 
>> 
>> 
>> Here's how I declare the dependency:
>>            <dependency>
>>                <groupId>org.apache.sling</groupId>
>>                <artifactId>org.apache.sling.event</artifactId>
>>                <version>3.3.1-SNAPSHOT</version>
>>                <scope>provided</scope>
>>            </dependency>
>> 
>> 
>> 
>> As an experiment/debugging, when I try to call the jobConsumerManager service directly like:
>> 
>>    @Reference
>>    private JobConsumerManager jobConsumerManager = null;
>> 
>>        LOGGER.debug("executor:" + jobConsumerManager.getExecutor(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED));
>>        LOGGER.debug("topics:" + jobConsumerManager.getTopics());
>> 
>> I get class not found errors:
>> 
>> 25│Caused by: java.lang.ClassNotFoundException: org.apache.sling.event.impl.jobs.JobConsumerManager not found by astra-core [103]                                                                   │te
>> d │    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1500) ~[na:na].in                                                                       │
>> 25│    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) ~[na:na].:1                                                                                              │
>> 25│    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1923) ~[na:na].ch                                                                           │
>> 25│    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.7.0_40].:                                                                                                                    │
>> 25│    ... 34 common frames omitted...                                                                                                                                                              │
>> 25│25.10.2013 00:27:11.102 *ERROR* [FelixFrameworkWiring] astra-core [com.astracorp.engine.commons.schedulers.DatastorePeriodicGC] Cannot register Component (java.lang.NoClassDefFoundError: org/ap│
>> 25│ache/sling/event/impl/jobs/JobConsumerManager)                                                                                                                                                   │
>> 25│java.lang.NoClassDefFoundError: org/apache/sling/event/impl/jobs/JobConsumerManager                                                                                                              │
>> 25│    at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.7.0_40].cr                                                                                                                      │
>> 25│    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521) ~[na:1.7.0_40].ac                                                                                                              │ch
>> e.│    at java.lang.Class.getDeclaredMethods(Class.java:1845) ~[na:1.7.0_40].nd                                                                                                                     │ef
>> au│    at org.apache.felix.scr.impl.helper.BindMethod.getServiceObjectAssignableMethod(BindMethod.java:389) ~[org.apache.felix.scr-1.6.0.jar:na].Ba                                                 │
>> 
>> 
>> 
>> I've tried changing the scope to compile, I've tried moving back version numbers, and nothing seems to work.
>> 
>> Any ideas?
>> 
>> 
>> Rob
>> 
>> On Oct 24, 2013, at 7:09 PM, Robert A. Decker wrote:
>> 
>>> Hi,
>>> 
>>> I'm trying to implement the new job system using a recent sling build. org.apache.sling.event is at 3.3.1-SNAPSHOT. (updated this morning)
>>> 
>>> What I'm doing is very similar to the example at the sling website. And I can see my events being created under the /var/eventing/jobs/unassigned node, so creating the events seems to be working, but my consumer just isn't consuming them.
>>> 
>>> Here's how I create them:
>>> 
>>> jobManager.addJob(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED, DatastoreGCService.DATASTORE_GC_REQUESTED_JOB_PROPERTIES);
>>> 
>>> TOPIC_DATASTORE_GC_REQUESTED = "com/astracorp/core/datastore/gc/requested";
>>> DATASTORE_GC_REQUESTED_JOB_PROPERTIES = new HashMap<String,Object>();
>>> 
>>> 
>>> Here's what my consumer looks like:
>>> 
>>> @Component(enabled = true, immediate = true, metatype = true)
>>> @Service(value = JobConsumer.class)
>>> @Property(name = JobConsumer.PROPERTY_TOPICS, value = {DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED})
>>> public class DatastoreGCHandler implements JobConsumer {
>>>   public static final Logger LOGGER = LoggerFactory.getLogger(DatastoreGCHandler.class);
>>> 
>>>   @Override
>>>   public JobResult process(final Job job) {
>>>       LOGGER.debug("process job called");
>>>       return null;
>>>   }
>>> }
>>> 
>>> 
>>> The consumer is listed in the services as:
>>> [org.apache.sling.event.jobs.consumer.JobConsumer]
>>> component.id	136
>>> component.name	com.astracorp.engine.commons.handlers.DatastoreGCHandler
>>> job.topics	com/astracorp/core/datastore/gc/requested
>>> Service PID	com.astracorp.engine.commons.handlers.DatastoreGCHandler
>>> 
>>> 
>>> 
>>> Everything looks fine to me but it's just not consuming. Am I missing something? I notice that some components are not running, but I'm not sure which is required.
>>> 
>>> org.apache.sling.event.impl.jobs.deprecated.JobStatusProviderImpl : registered
>>> org.apache.sling.event.impl.jobs.tasks.HistoryCleanUpTask : registered
>>> org.apache.sling.event.jobs.QueueConfiguration : unsatisfied  (probably needs a config)
>>> 
>>> 
>>> Rob
>>> 
>>> 
>> 
>> 
>> 
>> 
>> -- 
>> Carsten Ziegeler
>> cziegeler@apache.org
> 
> 


Re: trying to implement the new job system

Posted by "Robert A. Decker" <de...@robdecker.com>.
I'm trying to figure out why my jobs aren't being consumed. Here's one thing I found.

In JobManagerImpl.java, handleEvent method:

    public void handleEvent(final Event event) {
        if ( SlingConstants.TOPIC_RESOURCE_ADDED.equals(event.getTopic()) ) {
            final String path = (String) event.getProperty(SlingConstants.PROPERTY_PATH);
            final String rt = (String) event.getProperty(SlingConstants.PROPERTY_RESOURCE_TYPE);
            if ( (rt == null || ResourceHelper.RESOURCE_TYPE_JOB.equals(rt)) &&
                 this.configuration.isLocalJob(path) ) {
                synchronized ( this.directlyAddedPaths ) {
                    if ( directlyAddedPaths.remove(path) ) {
                        return;
                    }
                }
                this.backgroundLoader.loadJob(path);
            }
            this.jobScheduler.handleEvent(event);
        } else if ( Utility.TOPIC_STOP.equals(event.getTopic()) ) {


this.configuration.isLocalJob(path) evaluates as false and so my job is not added to the backgroundLoader, but instead gets sent to the scheduler. But because this is not a scheduled job type it isn't added to the queue by the jobScheduler.
                if ( path != null && path.startsWith(this.config.getScheduledJobsPathWithSlash())
                     && (resourceType == null || ResourceHelper.RESOURCE_TYPE_SCHEDULED_JOB.equals(resourceType))) {

For the JobManagerConfiguration.isLocalJob method:
    public boolean isLocalJob(final String jobPath) {
        return jobPath.startsWith(this.localJobsPathWithSlash);
    }

my jobPath=/var/eventing/jobs/unassigned/com.astracorp.core.datastore.gc.requested/2013/10/26/16/16/com.astracorp.core.datastore.gc.requested_622b9d5e-e949-490e-88b6-71e6498802a7_32
and JobManagerConfiguration.localJobsPathWithSlash=/var/eventing/jobs/assigned/622b9d5e-e949-490e-88b6-71e6498802a7/


Any ideas? What's the difference between /var/eventing/jobs/unassigned and /var/eventing/jobs/assigned?


Rob



On Oct 25, 2013, at 9:24 AM, Carsten Ziegeler wrote:

> Hi,
> 
> the JobConsumerManager is not public api and therefore not available to other bundles.
> Looking at your example from the first post, it looks ok to me - it should work without a specific queue configuration as the main queue is always available.
> However your job consumer implementation shouldn't return null but a result.
> 
> Carsten
> 
> 
> 2013/10/25 Robert A. Decker <de...@robdecker.com>
> I think I'm having a maven dependency problem, but I'm just not sure...
> 
> Here's what my org.apache.sling.event bundle looks like:
> 
> 
> 
> 
> Here's how I declare the dependency:
>             <dependency>
>                 <groupId>org.apache.sling</groupId>
>                 <artifactId>org.apache.sling.event</artifactId>
>                 <version>3.3.1-SNAPSHOT</version>
>                 <scope>provided</scope>
>             </dependency>
> 
> 
> 
> As an experiment/debugging, when I try to call the jobConsumerManager service directly like:
> 
>     @Reference
>     private JobConsumerManager jobConsumerManager = null;
> 
>         LOGGER.debug("executor:" + jobConsumerManager.getExecutor(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED));
>         LOGGER.debug("topics:" + jobConsumerManager.getTopics());
> 
> I get class not found errors:
> 
> 25│Caused by: java.lang.ClassNotFoundException: org.apache.sling.event.impl.jobs.JobConsumerManager not found by astra-core [103]                                                                   │te
> d │    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1500) ~[na:na].in                                                                       │
> 25│    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) ~[na:na].:1                                                                                              │
> 25│    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1923) ~[na:na].ch                                                                           │
> 25│    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.7.0_40].:                                                                                                                    │
> 25│    ... 34 common frames omitted...                                                                                                                                                              │
> 25│25.10.2013 00:27:11.102 *ERROR* [FelixFrameworkWiring] astra-core [com.astracorp.engine.commons.schedulers.DatastorePeriodicGC] Cannot register Component (java.lang.NoClassDefFoundError: org/ap│
> 25│ache/sling/event/impl/jobs/JobConsumerManager)                                                                                                                                                   │
> 25│java.lang.NoClassDefFoundError: org/apache/sling/event/impl/jobs/JobConsumerManager                                                                                                              │
> 25│    at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.7.0_40].cr                                                                                                                      │
> 25│    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521) ~[na:1.7.0_40].ac                                                                                                              │ch
> e.│    at java.lang.Class.getDeclaredMethods(Class.java:1845) ~[na:1.7.0_40].nd                                                                                                                     │ef
> au│    at org.apache.felix.scr.impl.helper.BindMethod.getServiceObjectAssignableMethod(BindMethod.java:389) ~[org.apache.felix.scr-1.6.0.jar:na].Ba                                                 │
> 
> 
> 
> I've tried changing the scope to compile, I've tried moving back version numbers, and nothing seems to work.
> 
> Any ideas?
> 
> 
> Rob
> 
> On Oct 24, 2013, at 7:09 PM, Robert A. Decker wrote:
> 
>> Hi,
>> 
>> I'm trying to implement the new job system using a recent sling build. org.apache.sling.event is at 3.3.1-SNAPSHOT. (updated this morning)
>> 
>> What I'm doing is very similar to the example at the sling website. And I can see my events being created under the /var/eventing/jobs/unassigned node, so creating the events seems to be working, but my consumer just isn't consuming them.
>> 
>> Here's how I create them:
>> 
>> jobManager.addJob(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED, DatastoreGCService.DATASTORE_GC_REQUESTED_JOB_PROPERTIES);
>> 
>> TOPIC_DATASTORE_GC_REQUESTED = "com/astracorp/core/datastore/gc/requested";
>> DATASTORE_GC_REQUESTED_JOB_PROPERTIES = new HashMap<String,Object>();
>> 
>> 
>> Here's what my consumer looks like:
>> 
>> @Component(enabled = true, immediate = true, metatype = true)
>> @Service(value = JobConsumer.class)
>> @Property(name = JobConsumer.PROPERTY_TOPICS, value = {DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED})
>> public class DatastoreGCHandler implements JobConsumer {
>>    public static final Logger LOGGER = LoggerFactory.getLogger(DatastoreGCHandler.class);
>> 
>>    @Override
>>    public JobResult process(final Job job) {
>>        LOGGER.debug("process job called");
>>        return null;
>>    }
>> }
>> 
>> 
>> The consumer is listed in the services as:
>> [org.apache.sling.event.jobs.consumer.JobConsumer]
>> component.id	136
>> component.name	com.astracorp.engine.commons.handlers.DatastoreGCHandler
>> job.topics	com/astracorp/core/datastore/gc/requested
>> Service PID	com.astracorp.engine.commons.handlers.DatastoreGCHandler
>> 
>> 
>> 
>> Everything looks fine to me but it's just not consuming. Am I missing something? I notice that some components are not running, but I'm not sure which is required.
>> 
>> org.apache.sling.event.impl.jobs.deprecated.JobStatusProviderImpl : registered
>> org.apache.sling.event.impl.jobs.tasks.HistoryCleanUpTask : registered
>> org.apache.sling.event.jobs.QueueConfiguration : unsatisfied  (probably needs a config)
>> 
>> 
>> Rob
>> 
>> 
> 
> 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org


Re: trying to implement the new job system

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

the JobConsumerManager is not public api and therefore not available to
other bundles.
Looking at your example from the first post, it looks ok to me - it should
work without a specific queue configuration as the main queue is always
available.
However your job consumer implementation shouldn't return null but a result.

Carsten


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

> I think I'm having a maven dependency problem, but I'm just not sure...
>
> Here's what my org.apache.sling.event bundle looks like:
>
>
>
> Here's how I declare the dependency:
>             <dependency>
>                 <groupId>org.apache.sling</groupId>
>                 <artifactId>org.apache.sling.event</artifactId>
>                 <version>3.3.1-SNAPSHOT</version>
>                 <scope>provided</scope>
>             </dependency>
>
>
>
> As an experiment/debugging, when I try to call the jobConsumerManager
> service directly like:
>
>     @Reference
>     private JobConsumerManager jobConsumerManager = null;
>
>         LOGGER.debug("executor:" +
> jobConsumerManager.getExecutor(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED));
>         LOGGER.debug("topics:" + jobConsumerManager.getTopics());
>
> I get class not found errors:
>
> 25│Caused by: java.lang.ClassNotFoundException:
> org.apache.sling.event.impl.jobs.JobConsumerManager not found by
> astra-core [103]
>         │te
> d │    at
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1500)
> ~[na:na].in
>        │
> 25│    at
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
> ~[na:na].:1
>                               │
> 25│    at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1923)
> ~[na:na].ch
>            │
> 25│    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ~[na:1.7.0_40].:
>                                                         │
> 25│    ... 34 common frames omitted...
>
>                                              │
> 25│25.10.2013 00:27:11.102 *ERROR* [FelixFrameworkWiring]
> astra-core [com.astracorp.engine.commons.schedulers.DatastorePeriodicGC]
> Cannot register Component (java.lang.NoClassDefFoundError: org/ap│
> 25│ache/sling/event/impl/jobs/JobConsumerManager)
>
>                                              │
> 25│java.lang.NoClassDefFoundError:
> org/apache/sling/event/impl/jobs/JobConsumerManager
>
>           │
> 25│    at java.lang.Class.getDeclaredMethods0(Native Method)
> ~[na:1.7.0_40].cr
>                                                             │
> 25│    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
> ~[na:1.7.0_40].ac
>                                                     │ch
> e.│    at java.lang.Class.getDeclaredMethods(Class.java:1845)
> ~[na:1.7.0_40].nd
>                                                            │ef
> au│    at
> org.apache.felix.scr.impl.helper.BindMethod.getServiceObjectAssignableMethod(BindMethod.java:389)
> ~[org.apache.felix.scr-1.6.0.jar:na].Ba
>             │
>
>
>
> I've tried changing the scope to compile, I've tried moving back version
> numbers, and nothing seems to work.
>
> Any ideas?
>
>
> Rob
>
> On Oct 24, 2013, at 7:09 PM, Robert A. Decker wrote:
>
> Hi,
>
> I'm trying to implement the new job system using a recent sling build.
> org.apache.sling.event is at 3.3.1-SNAPSHOT. (updated this morning)
>
> What I'm doing is very similar to the example at the sling website. And I
> can see my events being created under the /var/eventing/jobs/unassigned
> node, so creating the events seems to be working, but my consumer just
> isn't consuming them.
>
> Here's how I create them:
>
> jobManager.addJob(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED,
> DatastoreGCService.DATASTORE_GC_REQUESTED_JOB_PROPERTIES);
>
> TOPIC_DATASTORE_GC_REQUESTED = "com/astracorp/core/datastore/gc/requested";
> DATASTORE_GC_REQUESTED_JOB_PROPERTIES = new HashMap<String,Object>();
>
>
> Here's what my consumer looks like:
>
> @Component(enabled = true, immediate = true, metatype = true)
> @Service(value = JobConsumer.class)
> @Property(name = JobConsumer.PROPERTY_TOPICS, value =
> {DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED})
> public class DatastoreGCHandler implements JobConsumer {
>    public static final Logger LOGGER =
> LoggerFactory.getLogger(DatastoreGCHandler.class);
>
>    @Override
>    public JobResult process(final Job job) {
>        LOGGER.debug("process job called");
>        return null;
>    }
> }
>
>
> The consumer is listed in the services as:
> [org.apache.sling.event.jobs.consumer.JobConsumer]
> component.id 136
> component.name com.astracorp.engine.commons.handlers.DatastoreGCHandler
> job.topics com/astracorp/core/datastore/gc/requested
> Service PID com.astracorp.engine.commons.handlers.DatastoreGCHandler
>
>
>
> Everything looks fine to me but it's just not consuming. Am I missing
> something? I notice that some components are not running, but I'm not sure
> which is required.
>
> org.apache.sling.event.impl.jobs.deprecated.JobStatusProviderImpl :
> registered
> org.apache.sling.event.impl.jobs.tasks.HistoryCleanUpTask : registered
> org.apache.sling.event.jobs.QueueConfiguration : unsatisfied  (probably
> needs a config)
>
>
> Rob
>
>
>
>


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: trying to implement the new job system

Posted by "Robert A. Decker" <de...@robdecker.com>.
I think I'm having a maven dependency problem, but I'm just not sure...

Here's what my org.apache.sling.event bundle looks like:




Here's how I declare the dependency:
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.event</artifactId>
                <version>3.3.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>



As an experiment/debugging, when I try to call the jobConsumerManager service directly like:

    @Reference
    private JobConsumerManager jobConsumerManager = null;

        LOGGER.debug("executor:" + jobConsumerManager.getExecutor(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED));
        LOGGER.debug("topics:" + jobConsumerManager.getTopics());

I get class not found errors:

25│Caused by: java.lang.ClassNotFoundException: org.apache.sling.event.impl.jobs.JobConsumerManager not found by astra-core [103]                                                                   │te
d │    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1500) ~[na:na].in                                                                       │
25│    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) ~[na:na].:1                                                                                              │
25│    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1923) ~[na:na].ch                                                                           │
25│    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.7.0_40].:                                                                                                                    │
25│    ... 34 common frames omitted...                                                                                                                                                              │
25│25.10.2013 00:27:11.102 *ERROR* [FelixFrameworkWiring] astra-core [com.astracorp.engine.commons.schedulers.DatastorePeriodicGC] Cannot register Component (java.lang.NoClassDefFoundError: org/ap│
25│ache/sling/event/impl/jobs/JobConsumerManager)                                                                                                                                                   │
25│java.lang.NoClassDefFoundError: org/apache/sling/event/impl/jobs/JobConsumerManager                                                                                                              │
25│    at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.7.0_40].cr                                                                                                                      │
25│    at java.lang.Class.privateGetDeclaredMethods(Class.java:2521) ~[na:1.7.0_40].ac                                                                                                              │ch
e.│    at java.lang.Class.getDeclaredMethods(Class.java:1845) ~[na:1.7.0_40].nd                                                                                                                     │ef
au│    at org.apache.felix.scr.impl.helper.BindMethod.getServiceObjectAssignableMethod(BindMethod.java:389) ~[org.apache.felix.scr-1.6.0.jar:na].Ba                                                 │



I've tried changing the scope to compile, I've tried moving back version numbers, and nothing seems to work.

Any ideas?


Rob

On Oct 24, 2013, at 7:09 PM, Robert A. Decker wrote:

> Hi,
> 
> I'm trying to implement the new job system using a recent sling build. org.apache.sling.event is at 3.3.1-SNAPSHOT. (updated this morning)
> 
> What I'm doing is very similar to the example at the sling website. And I can see my events being created under the /var/eventing/jobs/unassigned node, so creating the events seems to be working, but my consumer just isn't consuming them.
> 
> Here's how I create them:
> 
> jobManager.addJob(DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED, DatastoreGCService.DATASTORE_GC_REQUESTED_JOB_PROPERTIES);
> 
> TOPIC_DATASTORE_GC_REQUESTED = "com/astracorp/core/datastore/gc/requested";
> DATASTORE_GC_REQUESTED_JOB_PROPERTIES = new HashMap<String,Object>();
> 
> 
> Here's what my consumer looks like:
> 
> @Component(enabled = true, immediate = true, metatype = true)
> @Service(value = JobConsumer.class)
> @Property(name = JobConsumer.PROPERTY_TOPICS, value = {DatastoreGCService.TOPIC_DATASTORE_GC_REQUESTED})
> public class DatastoreGCHandler implements JobConsumer {
>    public static final Logger LOGGER = LoggerFactory.getLogger(DatastoreGCHandler.class);
> 
>    @Override
>    public JobResult process(final Job job) {
>        LOGGER.debug("process job called");
>        return null;
>    }
> }
> 
> 
> The consumer is listed in the services as:
> [org.apache.sling.event.jobs.consumer.JobConsumer]
> component.id	136
> component.name	com.astracorp.engine.commons.handlers.DatastoreGCHandler
> job.topics	com/astracorp/core/datastore/gc/requested
> Service PID	com.astracorp.engine.commons.handlers.DatastoreGCHandler
> 
> 
> 
> Everything looks fine to me but it's just not consuming. Am I missing something? I notice that some components are not running, but I'm not sure which is required.
> 
> org.apache.sling.event.impl.jobs.deprecated.JobStatusProviderImpl : registered
> org.apache.sling.event.impl.jobs.tasks.HistoryCleanUpTask : registered
> org.apache.sling.event.jobs.QueueConfiguration : unsatisfied  (probably needs a config)
> 
> 
> Rob
> 
>