Class ForwardingService

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

    public class ForwardingService
    extends Object
    implements org.apache.synapse.task.Task, ManagedLifecycle
    This task is responsible for forwarding a request to a given endpoint. This is based on a blocking implementation and can send only one message at a time. Also this supports Throttling and reliable messaging.
    • Method Detail

      • execute

        public void execute()
        Starts the execution of this task which grabs a message from the message queue and dispatch it to a given endpoint.
        Specified by:
        execute in interface org.apache.synapse.task.Task
      • fetch

        public MessageContext fetch()
                             throws StoreForwardException
        Receives the next message from the message store. On a connection issue to store, retry will happen in this method
        Returns:
        MessageContext of the last message received from the store.
        Throws:
        StoreForwardException - on an issue fetching a message from store. Here all connections to internal store will be closed. Also all connections made by consumer to poll messages will be closed
      • dispatch

        public void dispatch​(MessageContext messageContext)
        Sends the message to a given endpoint.
        Parameters:
        messageContext - synapse MessageContext to be sent
      • sendThroughFaultSeq

        public void sendThroughFaultSeq​(MessageContext msgCtx)
        Sending the out message through the fault sequence.
        Parameters:
        msgCtx - Synapse MessageContext to be sent through the fault sequence.
      • sendThroughDeactivateSeq

        public void sendThroughDeactivateSeq​(MessageContext msgCtx)
        Sending the out message through the deactivate sequence.
        Parameters:
        msgCtx - Synapse MessageContext to be sent through the deactivate sequence.
      • sendThroughReplySeq

        public boolean sendThroughReplySeq​(MessageContext outCtx)
        Sending the out message through the reply sequence.
        Parameters:
        outCtx - Synapse out MessageContext to be sent through the reply sequence.
        Returns:
        true if reply sequence invocation is successful false otherwise
      • 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