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 2014/05/01 12:40:36 UTC
Re: PROPERTY_JOB_PRIORITY on Job deprecated
In JavaDoc, I see that I can go from JobManager to queue and then to configuration:
Queue queue = jobManager.getQueue(queueName)
QueueConfiguration config = queue.getConfiguration();
but at that point I get stuck. I can’t do anything with the config other than read the values. Same thing with QueueConfigurationManager.
In the Sling class JobHandlingReplicationQueueProvider I see some code that does what I’d like to do using org.osgi.service.cm classes to set up a factory configuration for a queue. Basically, in the getOrCreateQueue method it does:
org.osgi.service.cm.ConfigurationAdmin configAdmin;
if (jobManager.getQueue(name) == null) {
org.osgi.service.cm.Configuration config = configAdmin.createFactoryConfiguration(QueueConfiguration.class.getName(), null);
// create a props dict and set values
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(ConfigurationConstants.PROP_NAME, name);
props.put(ConfigurationConstants.PROP_PRIORITY, "MAX");
config.update(props);
}
So, I do understand what’s happening here and I can work with this example. But using this method I can't change any queue properties on a running queue.
Is this the route I should take? Or is there something simpler? I also see InternalQueueConfiguration but not sure if I should really be looking there...
Robert A. Decker
decker@robdecker.com
http://robdecker.com/about
On 30 Apr 2014, at 11:56, Carsten Ziegeler <cz...@apache.org> wrote:
> The only way to configure the priority now is to use the queue
> configuration - which means all jobs in the same queue use the same
> priority.
>
> Carsten
>
>
> 2014-04-29 21:18 GMT+02:00 Robert A. Decker <de...@robdecker.com>:
>
>> I notice that the property
>> org.apache.sling.event.jobs.Job.PROPERTY_JOB_PRIORITY is deprecated.
>>
>> Is there something equivalent? I’ve been looking through the javadoc I
>> generated from a recent build and I don’t see anything.
>>
>> I found it useful to be able to set job priority in the past when I’ve had
>> thousands of jobs running in different queues.
>>
>>
>> Robert A. Decker
>> decker@robdecker.com
>> http://robdecker.com/about
>>
>>
>>
>
>
> --
> Carsten Ziegeler
> cziegeler@apache.org
Re: PROPERTY_JOB_PRIORITY on Job deprecated
Posted by "Robert A. Decker" <de...@robdecker.com>.
Nevermind, I now see the org.apache.sling.event.jobs.QueueConfiguration. I’ll see if I can figure out how to do this through osgiconfigs.
Robert A. Decker
decker@robdecker.com
http://robdecker.com/about
On 01 May 2014, at 12:40, Robert A. Decker <de...@robdecker.com> wrote:
> In JavaDoc, I see that I can go from JobManager to queue and then to configuration:
> Queue queue = jobManager.getQueue(queueName)
> QueueConfiguration config = queue.getConfiguration();
> but at that point I get stuck. I can’t do anything with the config other than read the values. Same thing with QueueConfigurationManager.
>
> In the Sling class JobHandlingReplicationQueueProvider I see some code that does what I’d like to do using org.osgi.service.cm classes to set up a factory configuration for a queue. Basically, in the getOrCreateQueue method it does:
>
> org.osgi.service.cm.ConfigurationAdmin configAdmin;
> if (jobManager.getQueue(name) == null) {
> org.osgi.service.cm.Configuration config = configAdmin.createFactoryConfiguration(QueueConfiguration.class.getName(), null);
> // create a props dict and set values
> Dictionary<String, Object> props = new Hashtable<String, Object>();
> props.put(ConfigurationConstants.PROP_NAME, name);
> props.put(ConfigurationConstants.PROP_PRIORITY, "MAX");
> config.update(props);
> }
>
> So, I do understand what’s happening here and I can work with this example. But using this method I can't change any queue properties on a running queue.
>
> Is this the route I should take? Or is there something simpler? I also see InternalQueueConfiguration but not sure if I should really be looking there...
>
> Robert A. Decker
> decker@robdecker.com
> http://robdecker.com/about
>
>
> On 30 Apr 2014, at 11:56, Carsten Ziegeler <cz...@apache.org> wrote:
>
>> The only way to configure the priority now is to use the queue
>> configuration - which means all jobs in the same queue use the same
>> priority.
>>
>> Carsten
>>
>>
>> 2014-04-29 21:18 GMT+02:00 Robert A. Decker <de...@robdecker.com>:
>>
>>> I notice that the property
>>> org.apache.sling.event.jobs.Job.PROPERTY_JOB_PRIORITY is deprecated.
>>>
>>> Is there something equivalent? I’ve been looking through the javadoc I
>>> generated from a recent build and I don’t see anything.
>>>
>>> I found it useful to be able to set job priority in the past when I’ve had
>>> thousands of jobs running in different queues.
>>>
>>>
>>> Robert A. Decker
>>> decker@robdecker.com
>>> http://robdecker.com/about
>>>
>>>
>>>
>>
>>
>> --
>> Carsten Ziegeler
>> cziegeler@apache.org
>
>