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
ThisTask
injects 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 void
destroy()
This method should implement the destroying of the implemented parts of the configuration.void
dispatch(MessageContext messageContext)
Sends the message to a given sequence.void
execute()
Starts the execution of this task which grabs a message from the message queue and inject it to a given sequence.MessageContext
fetch()
Receives the next message from the message store.void
init(SynapseEnvironment se)
This method should implement the initialization of the implemented parts of the configuration.boolean
isInitialized()
Checks whether this TaskService is properly initialized or not.boolean
terminate()
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:
execute
in interfaceorg.apache.synapse.task.Task
-
init
public void init(SynapseEnvironment se)
Description copied from interface:ManagedLifecycle
This method should implement the initialization of the implemented parts of the configuration.- Specified by:
init
in interfaceManagedLifecycle
- Parameters:
se
- SynapseEnvironment to be used for initialization
-
fetch
public MessageContext fetch()
Receives the next message from the message store.- Returns:
MessageContext
of 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:
true
if the job is terminated successfully,false
otherwise.
-
isInitialized
public boolean isInitialized()
Checks whether this TaskService is properly initialized or not.- Returns:
true
if this TaskService is properly initialized.false
otherwise.
-
destroy
public void destroy()
Description copied from interface:ManagedLifecycle
This method should implement the destroying of the implemented parts of the configuration.- Specified by:
destroy
in interfaceManagedLifecycle
-
-