org.mule.umo.provider
Interface UMOMessageDispatcher

All Superinterfaces:
Disposable, UMOConnectable
All Known Implementing Classes:
AbstractMessageDispatcher

public interface UMOMessageDispatcher
extends Disposable, UMOConnectable

UMOMessageDispatcher is the interface responsible for distpatching events to a particular transport. It implements the client code necessary to write data to the underlying protocol. The dispatcher also exposes a receive method that allows users to make specific calls to the underlying transport to receive an event.

Version:
$Revision: 3798 $
Author:
Ross Mason

Field Summary
static long RECEIVE_NO_WAIT
           
static long RECEIVE_WAIT_INDEFINITELY
           
 
Method Summary
 void dispatch(UMOEvent event)
          Dispatches an event from the endpoint to the external system
 UMOConnector getConnector()
          Gets the connector for this dispatcher
 Object getDelegateSession()
          If the underlying transport has the notion of a client session when writing to it, the session should be obtainable using this method.
 OutputStream getOutputStream(UMOImmutableEndpoint endpoint, UMOMessage message)
          Well get the output stream (if any) for this type of transport.
 boolean isDisposed()
          Determines if this dispatcher has been disposed.
 UMOMessage receive(UMOEndpointURI endpointUri, long timeout)
          Deprecated. Use receive(UMOImmutableEndpoint endpoint, long timeout)
 UMOMessage receive(UMOImmutableEndpoint endpoint, long timeout)
          Make a specific request to the underlying transport
 UMOMessage send(UMOEvent event)
          Sends an event from the endpoint to the external system
 
Methods inherited from interface org.mule.umo.lifecycle.Disposable
dispose
 
Methods inherited from interface org.mule.umo.provider.UMOConnectable
connect, disconnect, getConnectionDescription, isConnected
 

Field Detail

RECEIVE_WAIT_INDEFINITELY

public static final long RECEIVE_WAIT_INDEFINITELY
See Also:
Constant Field Values

RECEIVE_NO_WAIT

public static final long RECEIVE_NO_WAIT
See Also:
Constant Field Values
Method Detail

dispatch

public void dispatch(UMOEvent event)
              throws DispatchException
Dispatches an event from the endpoint to the external system

Parameters:
event - The event to dispatch
Throws:
DispatchException - if the event fails to be dispatched

send

public UMOMessage send(UMOEvent event)
                throws DispatchException
Sends an event from the endpoint to the external system

Parameters:
event - The event to send
Returns:
event the response form the external system wrapped in a UMOEvent
Throws:
DispatchException - if the event fails to be dispatched

receive

public UMOMessage receive(UMOEndpointURI endpointUri,
                          long timeout)
                   throws Exception
Deprecated. Use receive(UMOImmutableEndpoint endpoint, long timeout)

Make a specific request to the underlying transport

Parameters:
endpointUri - the endpoint URI to use when connecting to the resource
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 UMOMessage object. Null will be returned if no data was avaialable
Throws:
Exception - if the call to the underlying protocal cuases an exception

receive

public UMOMessage receive(UMOImmutableEndpoint endpoint,
                          long timeout)
                   throws Exception
Make a specific request to the underlying transport

Parameters:
endpoint - the endpoint to use when connecting to the resource
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 UMOMessage object. Null will be returned if no data was avaialable
Throws:
Exception - if the call to the underlying protocal cuases an exception

getDelegateSession

public Object getDelegateSession()
                          throws UMOException
If the underlying transport has the notion of a client session when writing to it, the session should be obtainable using this method. If there is no session a null will be returned

Returns:
the transport specific session or null if there is no session
Throws:
UMOException

getConnector

public UMOConnector getConnector()
Gets the connector for this dispatcher

Returns:
the connector for this dispatcher

isDisposed

public boolean isDisposed()
Determines if this dispatcher has been disposed. Once disposed a dispatcher cannot be used again

Returns:
true if this dispatcher has been disposed, false otherwise

getOutputStream

public OutputStream getOutputStream(UMOImmutableEndpoint endpoint,
                                    UMOMessage message)
                             throws UMOException
Well get the output stream (if any) for this type of transport. Typically this will be called only when Streaming is being used on an outbound endpoint

Parameters:
endpoint - the endpoint that releates to this Dispatcher
message - the current message being processed
Returns:
the output stream to use for this request or null if the transport does not support streaming
Throws:
UMOException


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.