On Thu, 2015-11-26 at 20:46 +0000, Roll, Kevin wrote: > After a lot of documentation-reading, experimenting, and debugging, I > got this to work. I can post the code if anyone else is interested in > how to do this.
Sure, feel free to raise a documentation bug and add the code / instructions in there. Robert > > > -----Original Message----- > From: Steven Walters [mailto:steven.walt...@icidigital.com] > Sent: Tuesday, November 24, 2015 5:51 PM > To: users@sling.apache.org > Subject: Re: Custom queue > > On Tue, Nov 24, 2015 at 5:18 PM, Roll, Kevin <kevin-r...@idexx.com> > wrote: > > > > I have implemented a job as described here: > > > > https://sling.apache.org/documentation/bundles/apache-sling-eventin > > g-and-job-handling.html > > > > @Component(immediate = true) > > @Service(value = JobConsumer.class) > > @Property(name = JobConsumer.PROPERTY_TOPICS, value = > > ImageManagerUploadJob.JOB_TOPIC) > > public final class ImageManagerUploadJob implements JobConsumer > > { > > > > I wish to have this Job handled by a custom queue that processes > > jobs sequentially, i.e. on a single thread. Forgive my densitude > > but I'm not understanding how/where to apply the properties given > > on that documentation page. It sounds like I define a queue and > > then associate the job with it? I haven't been able to find an > > example of this. I'd like this all to be in code so it always works > > without tinkering with stuff in the OSGi container. Thanks! > > > > You need to create a new configuration from the factory-style > configuration "Apache Sling Job Queue Configuration" > (org.apache.sling.event.jobs.QueueConfiguration) to create a new > queue > that has the desired topic(s) associated to it to have your jobs be > processed within that queue and its configuration parameters. > > You could possibly have this configuration in "code" by either of > 1) Accessing the org.osgi.service.cm.ConfigurationAdmin service and > creating a configuration via this mechanism, such as in a > BundleActivator . > 2) Utilizing Sling's JCR Content Loader [1] and JCR Installer > Provider > [2] mechanisms to have a sling:OsgiConfig content node be > automatically created & installed when the jar bundle starts. > > There may be other possible routes depending on if other 3rd > party/external plugins/frameworks are within your Sling instance. > > [1] https://sling.apache.org/documentation/bundles/content-loading-jc > r-contentloader.html > [2] https://sling.apache.org/documentation/bundles/jcr-installer-prov > ider.html > > Regards, > Steven