Class ForwardingService
- java.lang.Object
-
- org.apache.synapse.message.processor.impl.forwarder.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.
-
-
Constructor Summary
Constructors Constructor Description ForwardingService(MessageProcessor messageProcessor, BlockingMsgSender sender, SynapseEnvironment synapseEnvironment, long threshouldInterval)ForwardingService(MessageProcessor messageProcessor, BlockingMsgSender sender, SynapseEnvironment synapseEnvironment, long thresholdInterval, 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 endpoint.voidexecute()Starts the execution of this task which grabs a message from the message queue and dispatch it to a given endpoint.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.voidsendThroughDeactivateSeq(MessageContext msgCtx)Sending the out message through the deactivate sequence.voidsendThroughFaultSeq(MessageContext msgCtx)Sending the out message through the fault sequence.booleansendThroughReplySeq(MessageContext outCtx)Sending the out message through the reply sequence.booleanterminate()Terminates the job of the message processor.
-
-
-
Constructor Detail
-
ForwardingService
public ForwardingService(MessageProcessor messageProcessor, BlockingMsgSender sender, SynapseEnvironment synapseEnvironment, long threshouldInterval)
-
ForwardingService
public ForwardingService(MessageProcessor messageProcessor, BlockingMsgSender sender, SynapseEnvironment synapseEnvironment, long thresholdInterval, boolean isDeactivatedAtStartup)
-
-
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:
executein interfaceorg.apache.synapse.task.Task
-
init
public void init(SynapseEnvironment se) throws SynapseException
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- Throws:
SynapseException
-
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:
MessageContextof 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- synapseMessageContextto be sent
-
sendThroughFaultSeq
public void sendThroughFaultSeq(MessageContext msgCtx)
Sending the out message through the fault sequence.- Parameters:
msgCtx- SynapseMessageContextto be sent through the fault sequence.
-
sendThroughDeactivateSeq
public void sendThroughDeactivateSeq(MessageContext msgCtx)
Sending the out message through the deactivate sequence.- Parameters:
msgCtx- SynapseMessageContextto be sent through the deactivate sequence.
-
sendThroughReplySeq
public boolean sendThroughReplySeq(MessageContext outCtx)
Sending the out message through the reply sequence.- Parameters:
outCtx- Synapse outMessageContextto be sent through the reply sequence.- Returns:
trueif reply sequence invocation is successfulfalseotherwise
-
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
-
-