org.mule.transport
Class AbstractMessageDispatcher
java.lang.Object
org.mule.transport.AbstractConnectable
org.mule.transport.AbstractMessageDispatcher
- All Implemented Interfaces:
- ExceptionListener, Disposable, Initialisable, Startable, Stoppable, Connectable, MessageDispatcher, MessageDispatching
- Direct Known Subclasses:
- AxisMessageDispatcher, CxfMessageDispatcher, FileMessageDispatcher, FtpMessageDispatcher, HttpClientMessageDispatcher, JdbcMessageDispatcher, JmsMessageDispatcher, ProcessMessageDispatcher, QuartzMessageDispatcher, RmiMessageDispatcher, SmtpMessageDispatcher, StdioMessageDispatcher, TcpMessageDispatcher, UdpMessageDispatcher, UnsupportedMessageDispatcher, VMMessageDispatcher, XmppMessageDispatcher
public abstract class AbstractMessageDispatcher
- extends AbstractConnectable
- implements MessageDispatcher
Provide a default dispatch (client) support for handling threads lifecycle and validation.
Methods inherited from class org.mule.transport.AbstractConnectable |
activate, connect, disconnect, disposeAndLogException, doConnect, doDisconnect, doDispose, doInitialise, doStart, doStop, exceptionThrown, getConnectEventId, getConnectionDescription, getConnector, handleException, isConnected, isDoThreading, isStarted, passivate, setEndpoint, start, stop, toString, validate, validateConnection |
Methods inherited from interface org.mule.api.lifecycle.Startable |
start |
Methods inherited from interface org.mule.api.lifecycle.Stoppable |
stop |
AbstractMessageDispatcher
public AbstractMessageDispatcher(OutboundEndpoint endpoint)
initialise
public final void initialise()
throws InitialisationException
- Description copied from interface:
Initialisable
- Method used to perform any initialisation work. If a fatal error occurs during
initialisation an
InitialisationException
should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException
should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.
- Specified by:
initialise
in interface Initialisable
- Overrides:
initialise
in class AbstractConnectable
- Throws:
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdown
RecoverableException
- if an error occurs that can be recovered from
dispose
public final void dispose()
- Description copied from class:
AbstractConnectable
- Template method to destroy any resources held by the Message Dispatcher
- Specified by:
dispose
in interface Disposable
- Overrides:
dispose
in class AbstractConnectable
dispatch
public final void dispatch(MuleEvent event)
throws DispatchException
- Description copied from interface:
MessageDispatching
- Dispatches an event from the endpoint to the external system
- Specified by:
dispatch
in interface MessageDispatching
- Parameters:
event
- The event to dispatch
- Throws:
DispatchException
- if the event fails to be dispatched
send
public final MuleMessage send(MuleEvent event)
throws DispatchException
- Description copied from interface:
MessageDispatching
- Sends an event from the endpoint to the external system
- Specified by:
send
in interface MessageDispatching
- Parameters:
event
- The event to send
- Returns:
- event the response form the external system wrapped in a MuleEvent
- Throws:
DispatchException
- if the event fails to be dispatched
returnResponse
protected boolean returnResponse(MuleEvent event)
- RemoteSync causes the message dispatch to wait for a response to an event on a
response channel after it sends the event. The following rules apply to
RemoteSync:
- The connector has to support remoteSync. Some transports do not
have the notion of a response channel.
- Check if the endpoint has been configured for remoteSync.
- Check if the REMOTE_SYNC message header has been set.
- 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 resposne from the
event dispatch.
isTransactionRollback
protected boolean isTransactionRollback()
- Checks to see if the current transaction has been rolled back
- Returns:
getWorkManager
protected WorkManager getWorkManager()
- Specified by:
getWorkManager
in class AbstractConnectable
getEndpoint
public OutboundEndpoint getEndpoint()
- Specified by:
getEndpoint
in interface MessageDispatcher
- Overrides:
getEndpoint
in class AbstractConnectable
- Returns:
- the endpoint which we are dispatching events to
doDispatch
protected abstract void doDispatch(MuleEvent event)
throws Exception
- Throws:
Exception
doSend
protected abstract MuleMessage doSend(MuleEvent event)
throws Exception
- Throws:
Exception
Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.