Class SamplingService

  • All Implemented Interfaces:
    ManagedLifecycle, org.apache.synapse.task.Task

    public class SamplingService
    extends Object
    implements org.apache.synapse.task.Task, ManagedLifecycle
    This Task injects a message to a given sequence. It also supports Throttling scenarios.
    • 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 interface org.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 interface ManagedLifecycle
        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 interface ManagedLifecycle