Class JobManagerConfiguration
java.lang.Object
org.apache.sling.event.impl.jobs.config.JobManagerConfiguration
Configuration of the job handling
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
Default background load delay.static final String
Default resource path for jobs.static final String
Default resource path for scheduled jobs.static final String
The background loader waits this time of seconds after startup before loading events from the repository.static final String
The path where all jobs are stored.static final String
Configuration property for the scheduled jobs path. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
activate
(Map<String, Object> props, JobManagerConfiguration.Config config) Activate this component.void
addJobToRetryList
(org.apache.sling.event.jobs.Job job) void
addListener
(ConfigurationChangeListener service) Add a topology aware listenerList<org.apache.sling.event.jobs.Job>
Create a new resource resolver for reading and writing the resource tree.protected void
Deactivateboolean
Get the resource path for all assigned jobs.org.slf4j.Logger
The audit logger is logging actions for auditing.int
org.apache.sling.event.jobs.Job
getJobFromRetryList
(String jobId) Get the resource path for all jobs assigned to the current instanceorg.slf4j.Logger
Get main logger.int
getScheduledJobsPath
(boolean slash) Get the scheduled jobs pathgetStoragePath
(String topic, String jobId, boolean isSuccess) Get the storage path for finished jobs.Get the current topology capabilities.Get the resource path for all unassigned jobs.getUniqueId
(String jobTopic) Get the unique job idCreate a unique job path (folder and name) for the job.void
handleTopologyEvent
(TopologyEvent event) This method is invoked asynchronously from the TopologyHandler.boolean
isActive()
Is this component still active?boolean
boolean
isLocalJob
(String jobPath) boolean
isStoragePath
(String path) Check whether this is a storage path.boolean
removeJobFromRetryList
(org.apache.sling.event.jobs.Job job) void
Remove a topology aware listenerprotected void
update
(Map<String, Object> props, JobManagerConfiguration.Config config) Update with a new configuration
-
Field Details
-
DEFAULT_REPOSITORY_PATH
Default resource path for jobs.- See Also:
-
DEFAULT_BACKGROUND_LOAD_DELAY
public static final long DEFAULT_BACKGROUND_LOAD_DELAYDefault background load delay.- See Also:
-
DEFAULT_SCHEDULED_JOBS_PATH
Default resource path for scheduled jobs.- See Also:
-
PROPERTY_REPOSITORY_PATH
The path where all jobs are stored.- See Also:
-
PROPERTY_BACKGROUND_LOAD_DELAY
The background loader waits this time of seconds after startup before loading events from the repository. (in secs)- See Also:
-
PROPERTY_SCHEDULED_JOBS_PATH
Configuration property for the scheduled jobs path.- See Also:
-
-
Constructor Details
-
JobManagerConfiguration
public JobManagerConfiguration()
-
-
Method Details
-
activate
Activate this component.- Parameters:
props
- Configuration propertiesconfig
- Configuration properties- Throws:
RuntimeException
- If the default paths can't be created
-
update
Update with a new configuration -
deactivate
protected void deactivate()Deactivate -
getHistoryCleanUpRemovedJobs
public int getHistoryCleanUpRemovedJobs() -
isActive
public boolean isActive()Is this component still active?- Returns:
- Active?
-
createResourceResolver
Create a new resource resolver for reading and writing the resource tree. The resolver needs to be closed by the client. This ResourceResolver provides read and write access to all resources relevant for the event and job handling.- Returns:
- A resource resolver or
null
if the component is already deactivated. - Throws:
RuntimeException
- if the resolver can't be created.
-
getTopologyCapabilities
Get the current topology capabilities.- Returns:
- The capabilities or
null
-
getQueueConfigurationManager
-
getMainLogger
public org.slf4j.Logger getMainLogger()Get main logger.- Returns:
- The main logger.
-
getAssginedJobsPath
Get the resource path for all assigned jobs.- Returns:
- The path - does not end with a slash.
-
getUnassignedJobsPath
Get the resource path for all unassigned jobs.- Returns:
- The path - does not end with a slash.
-
getLocalJobsPath
Get the resource path for all jobs assigned to the current instance- Returns:
- The path - does not end with a slash
-
getUniquePath
public String getUniquePath(String targetId, String topic, String jobId, Map<String, Object> jobProperties) Create a unique job path (folder and name) for the job. -
getUniqueId
Get the unique job id -
isLocalJob
-
isJob
-
getJobsBasePathWithSlash
-
getProgressLogMaxCount
public int getProgressLogMaxCount() -
getPreviousVersionAnonPath
-
getPreviousVersionIdentifiedPath
-
disableDistribution
public boolean disableDistribution() -
getStoredCancelledJobsPath
-
getStoredSuccessfulJobsPath
-
getStoragePath
Get the storage path for finished jobs.- Parameters:
topic
- Topic of the finished jobjobId
- The job id of the finished job.isSuccess
- Whether processing was successful or not- Returns:
- The complete storage path
-
isStoragePath
Check whether this is a storage path. -
getScheduledJobsPath
Get the scheduled jobs path- Parameters:
slash
- Iffalse
the path is returned, iftrue
the path appended with a slash is returned.- Returns:
- The path for the scheduled jobs
-
handleTopologyEvent
This method is invoked asynchronously from the TopologyHandler. Therefore this method can't be invoked concurrently -
addListener
Add a topology aware listener- Parameters:
service
- Listener to notify about changes.
-
removeListener
Remove a topology aware listener- Parameters:
service
- Listener to notify about changes.
-
addJobToRetryList
public void addJobToRetryList(org.apache.sling.event.jobs.Job job) -
clearJobRetryList
-
removeJobFromRetryList
public boolean removeJobFromRetryList(org.apache.sling.event.jobs.Job job) -
getJobFromRetryList
-
getAuditLogger
public org.slf4j.Logger getAuditLogger()The audit logger is logging actions for auditing.- Returns:
- The logger
-