public abstract class AbstractMessageReceiver extends Object implements MessageReceiver
AbstractMessageReceiver provides common methods for all Message
Receivers provided with Mule. A message receiver enables an endpoint to receive a
message from an external system.| Modifier and Type | Field and Description |
|---|---|
protected WaitableBoolean |
connected |
protected edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean |
connecting |
protected ConnectionStrategy |
connectionStrategy |
protected AbstractConnector |
connector
the connector associated with this receiver
|
protected edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean |
disposing |
protected InboundEndpoint |
endpoint
The endpoint descriptor which is associated with this receiver
|
protected org.apache.commons.logging.Log |
logger
logger used by this class
|
protected String |
receiverKey
Stores the key to this receiver, as used by the Connector to
store the receiver.
|
protected boolean |
responseEndpoint |
protected Service |
service
The Service with which this receiver is associated with
|
protected WaitableBoolean |
stopped |
PHASE_NAMEPHASE_NAMEPHASE_NAMEPHASE_NAME| Constructor and Description |
|---|
AbstractMessageReceiver(Connector connector,
Service service,
InboundEndpoint endpoint)
Creates the Message Receiver
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Make the connection to the underlying transport.
|
void |
disconnect()
Disconnect the from the underlying transport
|
void |
dispose()
A lifecycle method where implementor should free up any resources.
|
protected abstract void |
doConnect() |
protected abstract void |
doDisconnect() |
protected abstract void |
doDispose() |
protected void |
doInitialise() |
protected abstract void |
doStart() |
protected abstract void |
doStop() |
protected String |
getConnectEventId() |
String |
getConnectionDescription()
Returns a string identifying the underlying resource
|
Connector |
getConnector() |
InboundEndpoint |
getEndpoint() |
EndpointURI |
getEndpointURI()
The endpointUri that this receiver listens on
|
InternalMessageListener |
getListener() |
String |
getReceiverKey() |
Service |
getService() |
protected WorkManager |
getWorkManager() |
void |
handleException(Exception exception) |
protected MuleMessage |
handleUnacceptedFilter(MuleMessage message) |
void |
initialise()
Method used to perform any initialisation work.
|
boolean |
isConnected()
Determines if this object is connected or not
|
MuleMessage |
routeMessage(MuleMessage message) |
MuleMessage |
routeMessage(MuleMessage message,
boolean synchronous) |
MuleMessage |
routeMessage(MuleMessage message,
boolean synchronous,
OutputStream outputStream) |
MuleMessage |
routeMessage(MuleMessage message,
OutputStream outputStream) |
MuleMessage |
routeMessage(MuleMessage message,
Transaction trans,
boolean synchronous) |
MuleMessage |
routeMessage(MuleMessage message,
Transaction trans,
boolean synchronous,
OutputStream outputStream) |
void |
setConnector(Connector connector) |
void |
setEndpoint(InboundEndpoint endpoint) |
protected void |
setExceptionDetails(MuleMessage message,
Throwable exception)
This method is used to set any additional aand possibly transport specific
information on the return message where it has an exception payload.
|
void |
setListener(InternalMessageListener listener) |
void |
setReceiverKey(String receiverKey) |
void |
setService(Service service) |
protected void |
setWorkManager(WorkManager workManager) |
void |
start() |
void |
stop() |
String |
toString() |
protected final org.apache.commons.logging.Log logger
protected Service service
protected InboundEndpoint endpoint
protected AbstractConnector connector
protected final edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean disposing
protected final WaitableBoolean connected
protected final WaitableBoolean stopped
protected final edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean connecting
protected String receiverKey
protected ConnectionStrategy connectionStrategy
protected boolean responseEndpoint
public AbstractMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException
connector - the endpoint that created this listenerservice - the service to associate with the receiver. When data is
received the service dispatchEvent or
sendEvent is used to dispatch the data to the
relivant UMO.endpoint - the provider contains the endpointUri on which the receiver
will listen on. The endpointUri can be anything and is specific to
the receiver implementation i.e. an email address, a directory, a
jms destination or port address.CreateExceptionService,
InboundEndpointpublic void initialise()
throws InitialisationException
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.initialise in interface InitialisableInitialisationException - if a fatal error occurs causing the Mule
instance to shutdownRecoverableException - if an error occurs that can be recovered frompublic InboundEndpoint getEndpoint()
getEndpoint in interface MessageReceiverpublic void handleException(Exception exception)
protected void setExceptionDetails(MuleMessage message, Throwable exception)
message - exception - public Connector getConnector()
getConnector in interface MessageReceiverpublic void setConnector(Connector connector)
setConnector in interface MessageReceiverpublic Service getService()
getService in interface MessageReceiverpublic final MuleMessage routeMessage(MuleMessage message) throws MuleException
routeMessage in interface MessageReceiverMuleExceptionpublic final MuleMessage routeMessage(MuleMessage message, boolean synchronous) throws MuleException
routeMessage in interface MessageReceiverMuleExceptionpublic final MuleMessage routeMessage(MuleMessage message, Transaction trans, boolean synchronous) throws MuleException
routeMessage in interface MessageReceiverMuleExceptionpublic final MuleMessage routeMessage(MuleMessage message, OutputStream outputStream) throws MuleException
routeMessage in interface MessageReceiverMuleExceptionpublic final MuleMessage routeMessage(MuleMessage message, boolean synchronous, OutputStream outputStream) throws MuleException
routeMessage in interface MessageReceiverMuleExceptionpublic final MuleMessage routeMessage(MuleMessage message, Transaction trans, boolean synchronous, OutputStream outputStream) throws MuleException
routeMessage in interface MessageReceiverMuleExceptionprotected MuleMessage handleUnacceptedFilter(MuleMessage message)
public void setEndpoint(InboundEndpoint endpoint)
setEndpoint in interface MessageReceiverendpoint - the endpoint to listen onImmutableEndpointpublic void setService(Service service)
setService in interface MessageReceiverservice - the service to associate with the receiver. When data is
received the service dispatchEvent or
sendEvent is used to dispatch the data to the
relivant UMO.public final void dispose()
Disposabledispose in interface Disposablepublic EndpointURI getEndpointURI()
MessageReceivergetEndpointURI in interface MessageReceiverprotected WorkManager getWorkManager()
protected void setWorkManager(WorkManager workManager)
public void connect()
throws Exception
Connectableconnect in interface ConnectableExceptionpublic void disconnect()
throws Exception
Connectabledisconnect in interface ConnectableExceptionpublic String getConnectionDescription()
ConnectablegetConnectionDescription in interface Connectablepublic final void start()
throws MuleException
start in interface StartableMuleExceptionpublic final boolean isConnected()
ConnectableisConnected in interface Connectablepublic InternalMessageListener getListener()
public void setListener(InternalMessageListener listener)
protected String getConnectEventId()
public void setReceiverKey(String receiverKey)
setReceiverKey in interface MessageReceiverpublic String getReceiverKey()
getReceiverKey in interface MessageReceiverprotected void doInitialise()
throws InitialisationException
InitialisationExceptionprotected abstract void doStart()
throws MuleException
MuleExceptionprotected abstract void doStop()
throws MuleException
MuleExceptionprotected abstract void doDispose()
Copyright © 2003-2012 MuleSource, Inc.. All Rights Reserved.