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 <[email protected]>

> 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 <[email protected]>
> >
> >> 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 <[email protected]>
> >>>>> 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
> >>>>> [email protected]
> >>>>
> >>>>
> >>>
> >>
> >>
> >
> >
> > --
> > Carsten Ziegeler
> > [email protected]
>
>
>


-- 
Carsten Ziegeler
[email protected]

Reply via email to