@Service(value=JobManagerConfiguration.class) @Properties(value={@Property(name="job.consumermanager.disableDistribution",boolValue=false,label="Disable Distribution",description="If the distribution is disabled, all jobs will be processed on the leader only! Please use this switch with care."),@Property(name="job.log.deprecation",boolValue=true,label="Deprecation Warnings",description="If this switch is enabled, deprecation warnings will be logged with the INFO level."),@Property(name="repository.path",value="/var/eventing/jobs",propertyPrivate=true),@Property(name="job.scheduled.jobs.path",value="/var/eventing/scheduled-jobs",propertyPrivate=true),@Property(name="load.delay",longValue=10L,propertyPrivate=true)}) public class JobManagerConfiguration extends Object implements org.apache.sling.discovery.TopologyEventListener
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_BACKGROUND_LOAD_DELAY
Default background load delay.
|
static boolean |
DEFAULT_BACKGROUND_LOAD_SEARCH
Default value for background loading.
|
static boolean |
DEFAULT_DISABLE_DISTRIBUTION
Default for disabling the distribution.
|
static boolean |
DEFAULT_LOG_DEPRECATION_WARNINGS
Default value for deprecation warnings.
|
static String |
DEFAULT_REPOSITORY_PATH
Default resource path for jobs.
|
static String |
DEFAULT_SCHEDULED_JOBS_PATH
Default resource path for scheduled jobs.
|
static String |
PROPERTY_BACKGROUND_LOAD_DELAY
The background loader waits this time of seconds after startup before loading events from the repository.
|
static String |
PROPERTY_DISABLE_DISTRIBUTION
Configuration switch for distributing the jobs.
|
static String |
PROPERTY_LOG_DEPRECATION_WARNINGS
Configuration property for deprecation warnings.
|
static String |
PROPERTY_REPOSITORY_PATH
The path where all jobs are stored.
|
static String |
PROPERTY_SCHEDULED_JOBS_PATH
Configuration property for the scheduled jobs path.
|
Constructor and Description |
---|
JobManagerConfiguration() |
Modifier and Type | Method and Description |
---|---|
protected void |
activate(Map<String,Object> props)
Activate this component.
|
void |
addJobToRetryList(Job job) |
void |
addListener(ConfigurationChangeListener service)
Add a topology aware listener
|
List<Job> |
clearJobRetryList() |
org.apache.sling.api.resource.ResourceResolver |
createResourceResolver()
Create a new resource resolver for reading and writing the resource tree.
|
protected void |
deactivate()
Deactivate
|
boolean |
disableDistribution() |
String |
getAssginedJobsPath()
Get the resource path for all assigned jobs.
|
org.slf4j.Logger |
getAuditLogger()
The audit logger is logging actions for auditing.
|
Job |
getJobFromRetryList(String jobId) |
String |
getLocalJobsPath()
Get the resource path for all jobs assigned to the current instance
|
String |
getLocksPath()
Get the resource path for all locks
|
org.slf4j.Logger |
getMainLogger()
Get main logger.
|
String |
getPreviousVersionAnonPath() |
String |
getPreviousVersionIdentifiedPath() |
QueueConfigurationManager |
getQueueConfigurationManager() |
String |
getScheduledJobsPath(boolean slash)
Get the scheduled jobs path
|
String |
getStoragePath(String topic,
String jobId,
boolean isSuccess)
Get the storage path for finished jobs.
|
String |
getStoredCancelledJobsPath() |
String |
getStoredSuccessfulJobsPath() |
TopologyCapabilities |
getTopologyCapabilities()
Get the current topology capabilities.
|
String |
getUnassignedJobsPath()
Get the resource path for all unassigned jobs.
|
String |
getUniqueId(String jobTopic)
Get the unique job id
|
String |
getUniquePath(String targetId,
String topic,
String jobId,
Map<String,Object> jobProperties)
Create a unique job path (folder and name) for the job.
|
void |
handleTopologyEvent(org.apache.sling.discovery.TopologyEvent event) |
boolean |
isActive() |
boolean |
isJob(String jobPath) |
boolean |
isLocalJob(String jobPath) |
boolean |
isLock(String lockPath) |
boolean |
isStoragePath(String path)
Check whether this is a storage path.
|
void |
queueConfigurationChanged()
This method is invoked by the queue configuration manager
whenever the queue configuration changes.
|
boolean |
removeJobFromRetryList(Job job) |
void |
removeListener(ConfigurationChangeListener service)
Remove a topology aware listener
|
protected void |
update(Map<String,Object> props)
Update with a new configuration
|
public static final String DEFAULT_REPOSITORY_PATH
public static final long DEFAULT_BACKGROUND_LOAD_DELAY
public static final boolean DEFAULT_DISABLE_DISTRIBUTION
public static final String DEFAULT_SCHEDULED_JOBS_PATH
public static final String PROPERTY_REPOSITORY_PATH
public static final String PROPERTY_BACKGROUND_LOAD_DELAY
public static final String PROPERTY_DISABLE_DISTRIBUTION
public static final String PROPERTY_SCHEDULED_JOBS_PATH
public static final boolean DEFAULT_BACKGROUND_LOAD_SEARCH
public static final String PROPERTY_LOG_DEPRECATION_WARNINGS
public static final boolean DEFAULT_LOG_DEPRECATION_WARNINGS
@Activate protected void activate(Map<String,Object> props)
props
- Configuration propertiesRuntimeException
- If the default paths can't be created@Deactivate protected void deactivate()
public boolean isActive()
public org.apache.sling.api.resource.ResourceResolver createResourceResolver()
null
if the component is already deactivated.RuntimeException
- if the resolver can't be created.public TopologyCapabilities getTopologyCapabilities()
null
public QueueConfigurationManager getQueueConfigurationManager()
public org.slf4j.Logger getMainLogger()
public String getAssginedJobsPath()
public String getUnassignedJobsPath()
public String getLocalJobsPath()
public String getLocksPath()
public String getUniquePath(String targetId, String topic, String jobId, Map<String,Object> jobProperties)
public boolean isLocalJob(String jobPath)
public boolean isJob(String jobPath)
public boolean isLock(String lockPath)
public String getPreviousVersionAnonPath()
public String getPreviousVersionIdentifiedPath()
public boolean disableDistribution()
public String getStoredCancelledJobsPath()
public String getStoredSuccessfulJobsPath()
public String getStoragePath(String topic, String jobId, boolean isSuccess)
topic
- Topic of the finished jobjobId
- The job id of the finished job.isSuccess
- Whether processing was successful or notpublic boolean isStoragePath(String path)
public String getScheduledJobsPath(boolean slash)
slash
- If false
the path is returned, if true
the path appended with a slash is returned.public void queueConfigurationChanged()
public void handleTopologyEvent(org.apache.sling.discovery.TopologyEvent event)
handleTopologyEvent
in interface org.apache.sling.discovery.TopologyEventListener
TopologyEventListener.handleTopologyEvent(org.apache.sling.discovery.TopologyEvent)
public void addListener(ConfigurationChangeListener service)
service
- Listener to notify about changes.public void removeListener(ConfigurationChangeListener service)
service
- Listener to notify about changes.public void addJobToRetryList(Job job)
public boolean removeJobFromRetryList(Job job)
public org.slf4j.Logger getAuditLogger()
Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.