Class SamplingService
- java.lang.Object
-
- org.apache.synapse.message.processor.impl.sampler.SamplingService
-
- All Implemented Interfaces:
ManagedLifecycle,org.apache.synapse.task.Task
public class SamplingService extends Object implements org.apache.synapse.task.Task, ManagedLifecycle
ThisTaskinjects a message to a given sequence. It also supports Throttling scenarios.
-
-
Constructor Summary
Constructors Constructor Description SamplingService(MessageProcessor messageProcessor, SynapseEnvironment synapseEnvironment, String concurrencyPropName, String sequencePropName)SamplingService(MessageProcessor messageProcessor, SynapseEnvironment synapseEnvironment, String concurrencyPropName, String sequencePropName, boolean isDeactivatedAtStartup)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()This method should implement the destroying of the implemented parts of the configuration.voiddispatch(MessageContext messageContext)Sends the message to a given sequence.voidexecute()Starts the execution of this task which grabs a message from the message queue and inject it to a given sequence.MessageContextfetch()Receives the next message from the message store.voidinit(SynapseEnvironment se)This method should implement the initialization of the implemented parts of the configuration.booleanisInitialized()Checks whether this TaskService is properly initialized or not.booleanterminate()Terminates the job of the message processor.
-
-
-
Constructor Detail
-
SamplingService
public SamplingService(MessageProcessor messageProcessor, SynapseEnvironment synapseEnvironment, String concurrencyPropName, String sequencePropName)
-
SamplingService
public SamplingService(MessageProcessor messageProcessor, SynapseEnvironment synapseEnvironment, String concurrencyPropName, String sequencePropName, boolean isDeactivatedAtStartup)
-
-
Method Detail
-
execute
public void execute()
Starts the execution of this task which grabs a message from the message queue and inject it to a given sequence.- Specified by:
executein interfaceorg.apache.synapse.task.Task
-
init
public void init(SynapseEnvironment se)
Description copied from interface:ManagedLifecycleThis method should implement the initialization of the implemented parts of the configuration.- Specified by:
initin interfaceManagedLifecycle- Parameters:
se- SynapseEnvironment to be used for initialization
-
fetch
public MessageContext fetch()
Receives the next message from the message store.- Returns:
MessageContextof the last message received from the store.
-
dispatch
public void dispatch(MessageContext messageContext)
Sends the message to a given sequence.- Parameters:
messageContext- message to be injected.
-
terminate
public boolean terminate()
Terminates the job of the message processor.- Returns:
trueif the job is terminated successfully,falseotherwise.
-
isInitialized
public boolean isInitialized()
Checks whether this TaskService is properly initialized or not.- Returns:
trueif this TaskService is properly initialized.falseotherwise.
-
destroy
public void destroy()
Description copied from interface:ManagedLifecycleThis method should implement the destroying of the implemented parts of the configuration.- Specified by:
destroyin interfaceManagedLifecycle
-
-