@ProviderType public interface JobManager
The job manager allows to create new jobs, search for jobs and get statistics about the current state.
The terminology used in the job manager is slightly different from common terminology: Each job has a topic and a topic is associated with a queue. Queues can be created through configuration and each queue can process one or more topics.
Modifier and Type | Interface and Description |
---|---|
static class |
JobManager.QueryType
The requested job types for the query.
|
Modifier and Type | Method and Description |
---|---|
Job |
addJob(java.lang.String topic,
java.util.Map<java.lang.String,java.lang.Object> properties)
Add a new job
If the topic is
null or illegal, no job is created and null is returned. |
JobBuilder |
createJob(java.lang.String topic)
Fluent API to create, start and schedule new jobs
|
java.util.Collection<Job> |
findJobs(JobManager.QueryType type,
java.lang.String topic,
long limit,
java.util.Map<java.lang.String,java.lang.Object>... templates)
Return all jobs of a given type.
|
Job |
getJob(java.lang.String topic,
java.util.Map<java.lang.String,java.lang.Object> template)
Find a job - either queued or active.
|
Job |
getJobById(java.lang.String jobId)
Return a job based on the unique id.
|
Queue |
getQueue(java.lang.String name)
Return a queue with a specific name (if running)
|
java.lang.Iterable<Queue> |
getQueues()
Return an iterator for all available queues.
|
java.util.Collection<ScheduledJobInfo> |
getScheduledJobs()
Return all available job schedules.
|
java.util.Collection<ScheduledJobInfo> |
getScheduledJobs(java.lang.String topic,
long limit,
java.util.Map<java.lang.String,java.lang.Object>... templates)
Return all matching available job schedules.
|
Statistics |
getStatistics()
Return statistics information about all queues.
|
java.lang.Iterable<TopicStatistics> |
getTopicStatistics()
Return statistics information about job topics.
|
boolean |
removeJobById(java.lang.String jobId)
Removes the job even if it is currently in processing.
|
Job |
retryJobById(java.lang.String jobId)
Retry a cancelled job.
|
void |
stopJobById(java.lang.String jobId)
Stop a job.
|
Statistics getStatistics()
java.lang.Iterable<TopicStatistics> getTopicStatistics()
Queue getQueue(java.lang.String name)
name
- The queue namenull
java.lang.Iterable<Queue> getQueues()
Job addJob(java.lang.String topic, java.util.Map<java.lang.String,java.lang.Object> properties)
null
or illegal, no job is created and null
is returned.
If properties are provided, all of them must be serializable. If there are non serializable
objects in the properties, no job is created and null
is returned.
A job topic is a hierarchical name separated by dashes, each part has to start with a letter,
allowed characters are letters, numbers and the underscore.
The returned job object is a snapshot of the job state taken at the time of creation. Updates
to the job state are not reflected and the client needs to get a new job object using the job id.
If the queue for processing this job is configured to drop the job, null
is returned
as well.topic
- The required job topic.properties
- Optional job properties. The properties must be serializable.null
if the job could not be created.Job getJobById(java.lang.String jobId)
jobId
- The unique identifier from Job.getId()
null
boolean removeJobById(java.lang.String jobId)
jobId
- The unique identifier from Job.getId()
true
if the job could be removed or does not exist anymore.
false
otherwise.Job getJob(java.lang.String topic, java.util.Map<java.lang.String,java.lang.Object> template)
topic
- Topic is required.template
- The map acts like a template. The searched job
must match the template (AND query).null
java.util.Collection<Job> findJobs(JobManager.QueryType type, java.lang.String topic, long limit, java.util.Map<java.lang.String,java.lang.Object>... templates)
type
- Required parameter for the type. See above.topic
- Topic can be used as a filter, if it is non-null, only jobs with this topic will be returned.limit
- A positive number indicating the maximum number of jobs returned by the iterator. A value
of zero or less indicates that all jobs should be returned.templates
- A list of filter property maps. Each map acts like a template. The searched job
must match the template (AND query). By providing several maps, different filters
are possible (OR query).void stopJobById(java.lang.String jobId)
jobId
- The job idJob retryJobById(java.lang.String jobId)
null
.jobId
- The job id.null
JobBuilder createJob(java.lang.String topic)
topic
- Required topicjava.util.Collection<ScheduledJobInfo> getScheduledJobs()
java.util.Collection<ScheduledJobInfo> getScheduledJobs(java.lang.String topic, long limit, java.util.Map<java.lang.String,java.lang.Object>... templates)
topic
- Topic can be used as a filter, if it is non-null, only jobs with this topic will be returned.limit
- A positive number indicating the maximum number of jobs returned by the iterator. A value
of zero or less indicates that all jobs should be returned.templates
- A list of filter property maps. Each map acts like a template. The searched job
must match the template (AND query). By providing several maps, different filters
are possible (OR query).Copyright © 2010 - 2020 Adobe. All Rights Reserved