org.mule.transport
Class AbstractMessageRequester

java.lang.Object
  extended by org.mule.transport.AbstractConnectable
      extended by org.mule.transport.AbstractMessageRequester
All Implemented Interfaces:
ExceptionListener, Disposable, Initialisable, Startable, Stoppable, Connectable, MessageRequester, MessageRequesting
Direct Known Subclasses:
AxisMessageRequester, CxfMessageRequester, FileMessageRequester, FtpMessageRequester, HttpClientMessageRequester, JdbcMessageRequester, JmsMessageRequester, RetrieveMessageRequester, TcpMessageRequester, UdpMessageRequester, UnsupportedMessageRequester, VMMessageRequester, XmppMessageRequester

public abstract class AbstractMessageRequester
extends AbstractConnectable
implements MessageRequester

The Message Requester is used to explicitly request messages from a message channel or resource rather than subscribing to inbound events or polling for messages. This is often used programatically but will not be used for inbound endpoints configured on services.


Field Summary
 
Fields inherited from class org.mule.transport.AbstractConnectable
connected, connector, disposed, endpoint, logger, retryTemplate, started, startOnConnect
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
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.transport.MessageRequesting
REQUEST_NO_WAIT, REQUEST_WAIT_INDEFINITELY
 
Constructor Summary
AbstractMessageRequester(InboundEndpoint endpoint)
           
 
Method Summary
 void dispose()
          Template method to destroy any resources held by the Message Dispatcher
protected abstract  MuleMessage doRequest(long timeout)
          Make a specific request to the underlying transport
 InboundEndpoint getEndpoint()
           
protected  WorkManager getWorkManager()
           
 void initialise()
          Method used to perform any initialisation work.
 MuleMessage request(long timeout)
          Make a specific request to the underlying transport
 
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mule.api.transport.MessageRequester
activate, 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.Startable
start
 
Methods inherited from interface org.mule.api.lifecycle.Stoppable
stop
 

Constructor Detail

AbstractMessageRequester

public AbstractMessageRequester(InboundEndpoint endpoint)
Method Detail

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

request

public final MuleMessage request(long timeout)
                          throws Exception
Make a specific request to the underlying transport

Specified by:
request in interface MessageRequesting
Parameters:
timeout - the maximum time the operation should block before returning. The call should return immediately if there is data available. If no data becomes available before the timeout elapses, null will be returned
Returns:
the result of the request wrapped in a MuleMessage object. Null will be returned if no data was available
Throws:
Exception - if the call to the underlying protocol causes an exception

getWorkManager

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

getEndpoint

public InboundEndpoint getEndpoint()
Specified by:
getEndpoint in interface MessageRequester
Overrides:
getEndpoint in class AbstractConnectable
Returns:
the endpoint used for requesting events

doRequest

protected abstract MuleMessage doRequest(long timeout)
                                  throws Exception
Make a specific request to the underlying transport

Parameters:
timeout - the maximum time the operation should block before returning. The call should return immediately if there is data available. If no data becomes available before the timeout elapses, null will be returned
Returns:
the result of the request wrapped in a MuleMessage object. Null will be returned if no data was avaialable
Throws:
Exception - if the call to the underlying protocal cuases an exception


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.