org.mule.transport
Class AbstractTransportMessageProcessTemplate<MessageReceiverType extends AbstractMessageReceiver,ConnectorType extends AbstractConnector>

java.lang.Object
  extended by org.mule.transport.AbstractTransportMessageProcessTemplate<MessageReceiverType,ConnectorType>
All Implemented Interfaces:
FlowProcessingPhaseTemplate, MessageProcessContext, MessageProcessTemplate, ValidationPhaseTemplate
Direct Known Subclasses:
HttpMessageProcessTemplate

public abstract class AbstractTransportMessageProcessTemplate<MessageReceiverType extends AbstractMessageReceiver,ConnectorType extends AbstractConnector>
extends Object
implements FlowProcessingPhaseTemplate, ValidationPhaseTemplate, MessageProcessContext


Field Summary
protected  Log logger
           
 
Constructor Summary
AbstractTransportMessageProcessTemplate(MessageReceiverType messageReceiver, WorkManager flowExecutionWorkManager)
           
 
Method Summary
abstract  Object acquireMessage()
          This method will only be called once for the MessageProcessContext
 void afterFailureProcessingFlow(MessagingException messagingException)
          Call when the processing of the message through the flow fails.
 void afterFailureProcessingFlow(MuleException exception)
          Call when the processing of the message through the flow fails in an exception strategy
 MuleEvent afterRouteEvent(MuleEvent muleEvent)
          Post processing of the routed MuleEvent
 void afterSuccessfulProcessingFlow(MuleEvent response)
          Call after successfully processing the message through the flow This method will always be called when the flow execution was successful.
 MuleEvent beforeRouteEvent(MuleEvent muleEvent)
          Pre processing of the MuleEvent to route
protected  MuleEvent createEventFromMuleMessage(MuleMessage muleMessage)
           
protected  MuleMessage createMessageFromSource(Object message)
           
 void discardInvalidMessage()
          Discards the message because the validation failed
protected  ConnectorType getConnector()
           
 FlowConstruct getFlowConstruct()
           
 WorkManager getFlowExecutionWorkManager()
           
protected  InboundEndpoint getInboundEndpoint()
           
protected  MessageReceiverType getMessageReceiver()
           
 MessageSource getMessageSource()
           
protected  MuleContext getMuleContext()
           
 MuleEvent getMuleEvent()
           
 Object getOriginalMessage()
           
protected  OutputStream getOutputStream()
           
 TransactionConfig getTransactionConfig()
           
protected  void propagateRootMessageIdProperty(MuleMessage message)
           
 MuleEvent routeEvent(MuleEvent muleEvent)
          Routes the MuleEvent through the processors chain
 boolean supportsAsynchronousProcessing()
           
 boolean validateMessage()
          Validates the message content.
protected  void warnIfMuleClientSendUsed(MuleMessage message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected transient Log logger
Constructor Detail

AbstractTransportMessageProcessTemplate

public AbstractTransportMessageProcessTemplate(MessageReceiverType messageReceiver,
                                               WorkManager flowExecutionWorkManager)
Method Detail

getMuleEvent

public MuleEvent getMuleEvent()
                       throws MuleException
Specified by:
getMuleEvent in interface FlowProcessingPhaseTemplate
Returns:
a MuleEvent created from the original message
Throws:
MuleException

getMessageSource

public MessageSource getMessageSource()
Specified by:
getMessageSource in interface MessageProcessContext
Returns:
the MessageSource that retrieve the message. Can not be null

getOriginalMessage

public Object getOriginalMessage()
                          throws MuleException
Specified by:
getOriginalMessage in interface FlowProcessingPhaseTemplate
Returns:
the original message
Throws:
MuleException

afterFailureProcessingFlow

public void afterFailureProcessingFlow(MessagingException messagingException)
                                throws MuleException
Description copied from interface: FlowProcessingPhaseTemplate
Call when the processing of the message through the flow fails. This method will always be called when the flow execution failed.

Specified by:
afterFailureProcessingFlow in interface FlowProcessingPhaseTemplate
Throws:
MuleException

afterFailureProcessingFlow

public void afterFailureProcessingFlow(MuleException exception)
                                throws MuleException
Description copied from interface: FlowProcessingPhaseTemplate
Call when the processing of the message through the flow fails in an exception strategy

Specified by:
afterFailureProcessingFlow in interface FlowProcessingPhaseTemplate
Throws:
MuleException

routeEvent

public MuleEvent routeEvent(MuleEvent muleEvent)
                     throws MuleException
Description copied from interface: FlowProcessingPhaseTemplate
Routes the MuleEvent through the processors chain

Specified by:
routeEvent in interface FlowProcessingPhaseTemplate
Parameters:
muleEvent - MuleEvent created from the raw message of this context
Returns:
the response MuleEvent
Throws:
MuleException

afterSuccessfulProcessingFlow

public void afterSuccessfulProcessingFlow(MuleEvent response)
                                   throws MuleException
Description copied from interface: FlowProcessingPhaseTemplate
Call after successfully processing the message through the flow This method will always be called when the flow execution was successful.

Specified by:
afterSuccessfulProcessingFlow in interface FlowProcessingPhaseTemplate
Throws:
MuleException

acquireMessage

public abstract Object acquireMessage()
                               throws MuleException
This method will only be called once for the MessageProcessContext

Returns:
the raw message from the MessageSource
Throws:
MuleException

propagateRootMessageIdProperty

protected void propagateRootMessageIdProperty(MuleMessage message)

validateMessage

public boolean validateMessage()
Description copied from interface: ValidationPhaseTemplate
Validates the message content. In case that the message is not valid then ValidationPhaseTemplate.discardInvalidMessage() will be executed so the implementation can save the reason why the message is invalid to report why the message has been discarded when ValidationPhaseTemplate.discardInvalidMessage() is called

Specified by:
validateMessage in interface ValidationPhaseTemplate
Returns:
false if the message is invalid, true otherwise

discardInvalidMessage

public void discardInvalidMessage()
                           throws MuleException
Description copied from interface: ValidationPhaseTemplate
Discards the message because the validation failed

Specified by:
discardInvalidMessage in interface ValidationPhaseTemplate
Throws:
MuleException

warnIfMuleClientSendUsed

protected void warnIfMuleClientSendUsed(MuleMessage message)

createEventFromMuleMessage

protected MuleEvent createEventFromMuleMessage(MuleMessage muleMessage)
                                        throws MuleException
Throws:
MuleException

getOutputStream

protected OutputStream getOutputStream()

createMessageFromSource

protected MuleMessage createMessageFromSource(Object message)
                                       throws MuleException
Throws:
MuleException

getMessageReceiver

protected MessageReceiverType getMessageReceiver()

getInboundEndpoint

protected InboundEndpoint getInboundEndpoint()

getConnector

protected ConnectorType getConnector()

getMuleContext

protected MuleContext getMuleContext()

getFlowConstruct

public FlowConstruct getFlowConstruct()
Specified by:
getFlowConstruct in interface MessageProcessContext
Returns:
the FlowConstruct were the incoming message is going to be executed. Can not be null

supportsAsynchronousProcessing

public boolean supportsAsynchronousProcessing()
Specified by:
supportsAsynchronousProcessing in interface MessageProcessContext
Returns:
true if the message can be processed in a different thread than the one it was acquired, false otherwise

beforeRouteEvent

public MuleEvent beforeRouteEvent(MuleEvent muleEvent)
                           throws MuleException
Description copied from interface: FlowProcessingPhaseTemplate
Pre processing of the MuleEvent to route

Specified by:
beforeRouteEvent in interface FlowProcessingPhaseTemplate
Throws:
MuleException

afterRouteEvent

public MuleEvent afterRouteEvent(MuleEvent muleEvent)
                          throws MuleException
Description copied from interface: FlowProcessingPhaseTemplate
Post processing of the routed MuleEvent

Specified by:
afterRouteEvent in interface FlowProcessingPhaseTemplate
Throws:
MuleException

getFlowExecutionWorkManager

public WorkManager getFlowExecutionWorkManager()
Specified by:
getFlowExecutionWorkManager in interface MessageProcessContext
Returns:
the WorkManager were the incoming message must be processed. If null it will be executed in the same thread were the message was received

getTransactionConfig

public TransactionConfig getTransactionConfig()
Specified by:
getTransactionConfig in interface MessageProcessContext
Returns:
the TransactionConfig associated to the MessageSource that received the message. If null then no transaction config will be used.


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.