org.mule.transport
Class AbstractMessageDispatcher

java.lang.Object
  extended by org.mule.transport.AbstractTransportMessageHandler
      extended by org.mule.transport.AbstractMessageDispatcher
All Implemented Interfaces:
Disposable, Initialisable, Lifecycle, LifecycleStateEnabled, Startable, Stoppable, MessageProcessor, Connectable, MessageDispatcher
Direct Known Subclasses:
AjaxMessageDispatcher, AxisMessageDispatcher, FileMessageDispatcher, FtpMessageDispatcher, HttpClientMessageDispatcher, JdbcMessageDispatcher, JmsMessageDispatcher, QuartzMessageDispatcher, RmiMessageDispatcher, SftpMessageDispatcher, SmtpMessageDispatcher, StdioMessageDispatcher, TcpMessageDispatcher, UdpMessageDispatcher, UnsupportedMessageDispatcher, VMMessageDispatcher, XmppMessageDispatcher

public abstract class AbstractMessageDispatcher
extends AbstractTransportMessageHandler
implements MessageDispatcher

Abstract implementation of an outbound channel adaptors. Outbound channel adaptors send messages over over a specific transport. Different implementations may support different Message Exchange Patterns.


Field Summary
protected  List<Transformer> defaultOutboundTransformers
           
protected  List<Transformer> defaultResponseTransformers
           
 
Fields inherited from class org.mule.transport.AbstractTransportMessageHandler
connected, connector, endpoint, lifecycleManager, logger, muleMessageFactory, retryTemplate
 
Fields inherited from interface org.mule.api.transport.MessageDispatcher
RECEIVE_NO_WAIT, RECEIVE_WAIT_INDEFINITELY
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
AbstractMessageDispatcher(OutboundEndpoint endpoint)
           
 
Method Summary
protected  void applyOutboundTransformers(MuleEvent event)
           
protected  void applyResponseTransformers(MuleEvent event)
           
protected  ConnectableLifecycleManager createLifecycleManager()
           
protected abstract  void doDispatch(MuleEvent event)
           
protected abstract  MuleMessage doSend(MuleEvent event)
           
protected  String getDispatcherName()
           
 OutboundEndpoint getEndpoint()
           
protected  WorkManager getWorkManager()
           
 MuleEvent process(MuleEvent event)
          Invokes the MessageProcessor.
protected  boolean returnResponse(MuleEvent event)
          Deprecated.  
protected  boolean returnResponse(MuleEvent event, boolean doSend)
          Used to determine if the dispatcher implementation should wait for a response to an event on a response channel after it sends the event.
 
Methods inherited from class org.mule.transport.AbstractTransportMessageHandler
activate, connect, connectHandler, createMuleMessage, createMuleMessage, createMuleMessage, createMuleMessageFactory, createNullMuleMessage, disconnect, dispose, disposeAndLogException, doConnect, doDisconnect, doDispose, doInitialise, doStart, doStartHandler, doStop, getConnectEventId, getConnectionDescription, getConnector, getLifecycleState, initialise, initializeMessageFactory, initializeRetryPolicy, isConnected, isDoThreading, isStarted, isStarting, isStopped, isStopping, passivate, setEndpoint, start, stop, toString, validate, validateConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mule.api.transport.MessageDispatcher
activate, createMuleMessage, createMuleMessage, getConnector, passivate, validate
 
Methods inherited from interface org.mule.api.transport.Connectable
connect, disconnect, getConnectionDescription, isConnected, validateConnection
 
Methods inherited from interface org.mule.api.lifecycle.Initialisable
initialise
 
Methods inherited from interface org.mule.api.lifecycle.Startable
start
 
Methods inherited from interface org.mule.api.lifecycle.Stoppable
stop
 
Methods inherited from interface org.mule.api.lifecycle.Disposable
dispose
 
Methods inherited from interface org.mule.api.lifecycle.LifecycleStateEnabled
getLifecycleState
 

Field Detail

defaultOutboundTransformers

protected List<Transformer> defaultOutboundTransformers

defaultResponseTransformers

protected List<Transformer> defaultResponseTransformers
Constructor Detail

AbstractMessageDispatcher

public AbstractMessageDispatcher(OutboundEndpoint endpoint)
Method Detail

createLifecycleManager

protected ConnectableLifecycleManager createLifecycleManager()
Specified by:
createLifecycleManager in class AbstractTransportMessageHandler

getDispatcherName

protected String getDispatcherName()

process

public MuleEvent process(MuleEvent event)
                  throws MuleException
Description copied from interface: MessageProcessor
Invokes the MessageProcessor.

Specified by:
process in interface MessageProcessor
Parameters:
event - MuleEvent to be processed
Returns:
optional response MuleEvent
Throws:
MuleException

returnResponse

@Deprecated
protected boolean returnResponse(MuleEvent event)
Deprecated. 


returnResponse

protected boolean returnResponse(MuleEvent event,
                                 boolean doSend)
Used to determine if the dispatcher implementation should wait for a response to an event on a response channel after it sends the event. The following rules apply:
  1. The connector has to support "back-channel" response. Some transports do not have the notion of a response channel.
  2. Check if the endpoint is synchronous (outbound synchronicity is not explicit since 2.2 and does not use the remoteSync message property).
  3. Or, if the send() method on the dispatcher was used. (This is required because the ChainingRouter uses send() with async endpoints. See MULE-4631).
  4. Finally, if the current service has a response router configured, that the router will handle the response channel event and we should not try and receive a response in the Message dispatcher If remotesync should not be used we must remove the REMOTE_SYNC header Note the MuleClient will automatically set the REMOTE_SYNC header when client.send(..) is called so that results are returned from remote invocations too.

Parameters:
event - the current event
Returns:
true if a response channel should be used to get a response from the event dispatch.

getWorkManager

protected WorkManager getWorkManager()
Specified by:
getWorkManager in class AbstractTransportMessageHandler

getEndpoint

public OutboundEndpoint getEndpoint()
Specified by:
getEndpoint in interface MessageDispatcher
Overrides:
getEndpoint in class AbstractTransportMessageHandler
Returns:
the endpoint which we are dispatching events to

applyOutboundTransformers

protected void applyOutboundTransformers(MuleEvent event)
                                  throws MuleException
Throws:
MuleException

applyResponseTransformers

protected void applyResponseTransformers(MuleEvent event)
                                  throws MuleException
Throws:
MuleException

doDispatch

protected abstract void doDispatch(MuleEvent event)
                            throws Exception
Throws:
Exception

doSend

protected abstract MuleMessage doSend(MuleEvent event)
                               throws Exception
Throws:
Exception


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