public abstract class ScheduledMessageProcessor extends AbstractMessageProcessor implements org.apache.synapse.task.TaskManagerObserver
Forwarding
and Sampling
message Processors.
Mainly
responsible for handling life cycle states of the message processors. Some of
the well known life cycle states are start
, pause
,
destroy
, deactivate
etc.Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
cronExpression
A cron expression to run the sampler
|
protected long |
interval
The interval at which this processor runs , default value is 1000ms
|
protected java.lang.String[] |
nonRetryStatusCodes
This is specially used for REST scenarios where http status codes can take semantics in a RESTful architecture.
|
protected BlockingMsgSender |
sender |
protected SynapseEnvironment |
synapseEnvironment |
artifactContainerName, configuration, description, fileName, isEdited, messageConsumers, messageStore, name, parameters, targetEndpoint
Constructor and Description |
---|
ScheduledMessageProcessor() |
Modifier and Type | Method and Description |
---|---|
boolean |
activate()
This method is used to activate a deactivated message processor.
|
void |
cleanupLocalResources()
This method is used to cleanup local resources such as JMS connections
used by the message processor.
|
boolean |
deactivate()
This method is used to deactivate the message processor.
|
void |
destroy()
This method should implement the destroying of the
implemented parts of the configuration.
|
void |
destroy(boolean preserveState)
Undeploy the artifact but keeps the current state based on the preserveState argument.
|
boolean |
getActivated() |
boolean |
getIsActivatedParamValue() |
protected abstract org.apache.synapse.task.Task |
getTask()
Gives the
Task instance associated with this processor. |
void |
init(SynapseEnvironment se)
This method should implement the initialization of the
implemented parts of the configuration.
|
boolean |
isActive() |
boolean |
isDeactivated()
This method is used to see if the message processor is deactivated.
|
boolean |
isPaused()
This method is used to check if the state is in paused mode.
|
protected boolean |
isProcessorStartAsDeactivated() |
protected boolean |
isThrottling(long interval)
nTask does not except values less than 1000 for its schedule interval.
|
boolean |
isThrottling(java.lang.String cronExpression) |
void |
pauseService()
This method is only used by the associated forwarding services of message processors.
|
void |
resumeService()
This is the opposite of pauseService method.
|
void |
setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
This method is used to set configuration parameters of the message processor.
|
boolean |
start()
This method is used to start the message processor.
|
boolean |
stop()
This method is used to stop the message processor.
|
void |
update() |
getArtifactContainerName, getDescription, getFileName, getMessageConsumer, getMessageStoreName, getName, getParameters, getTargetEndpoint, isEdited, setArtifactContainerName, setDescription, setFileName, setIsEdited, setMessageConsumer, setMessageStoreName, setName, setTargetEndpoint
protected long interval
protected java.lang.String cronExpression
protected java.lang.String[] nonRetryStatusCodes
protected BlockingMsgSender sender
protected SynapseEnvironment synapseEnvironment
public void init(SynapseEnvironment se)
ManagedLifecycle
init
in interface ManagedLifecycle
init
in class AbstractMessageProcessor
se
- SynapseEnvironment to be used for initializationpublic boolean getIsActivatedParamValue()
protected boolean isProcessorStartAsDeactivated()
public boolean start()
MessageProcessor
start
in interface MessageProcessor
true
if successful, false
otherwisepublic boolean isDeactivated()
MessageProcessor
isDeactivated
in interface MessageProcessor
true
if successful, false
otherwisepublic void setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
MessageProcessor
setParameters
in interface MessageProcessor
setParameters
in class AbstractMessageProcessor
parameters
- Message processor parameters.public boolean stop()
MessageProcessor
stop
in interface MessageProcessor
true
if successful, false
otherwisepublic void destroy()
ManagedLifecycle
destroy
in interface ManagedLifecycle
public void destroy(boolean preserveState)
AbstractMessageProcessor
destroy
in class AbstractMessageProcessor
preserveState
- determine whether to preserve the artifacts state or notpublic boolean deactivate()
MessageProcessor
deactivate
in interface MessageProcessor
true
if successful, false
otherwisepublic boolean activate()
MessageProcessor
activate
in interface MessageProcessor
true
if successful, false
otherwisepublic void pauseService()
MessageProcessor
pauseService
in interface MessageProcessor
public void resumeService()
MessageProcessor
resumeService
in interface MessageProcessor
public boolean isActive()
public boolean isPaused()
MessageProcessor
isPaused
in interface MessageProcessor
public boolean getActivated()
protected boolean isThrottling(long interval)
interval
- in which scheduler triggers its job.false
otherwise.public boolean isThrottling(java.lang.String cronExpression)
protected abstract org.apache.synapse.task.Task getTask()
Task
instance associated with this processor.Task
associated with this processor.public void update()
update
in interface org.apache.synapse.task.TaskManagerObserver
public void cleanupLocalResources()
MessageProcessor
cleanupLocalResources
in interface MessageProcessor
Copyright © 2005-2020 Apache Software Foundation. All Rights Reserved.