org.mule.extras.client
Class RemoteDispatcher

java.lang.Object
  extended byorg.mule.extras.client.RemoteDispatcher
All Implemented Interfaces:
Disposable

public class RemoteDispatcher
extends Object
implements Disposable

RemoteDispatcher is used to make and receive requests to a remote Mule instance. It is used to proxy requests to Mule using the Server URL as the transport channel.


Field Summary
protected static Log logger
          logger used by this class
 
Constructor Summary
protected RemoteDispatcher(String endpoint)
           
protected RemoteDispatcher(String endpoint, UMOCredentials credentials)
           
 
Method Summary
 FutureMessageResult asyncReceiveRemote(String endpoint, int timeout)
           
protected  UMOMessage dispatchAction(AdminNotification action, boolean synchronous, int timeout)
           
 void dispatchRemote(String endpoint, Object payload, Map messageProperties)
           
 void dispatchToRemoteComponent(String component, Object payload, Map messageProperties)
          Dispatcher an event asynchronously to a components on a remote Mule instance.
 void dispose()
          A lifecycle method where implementor should free up any resources.
protected  UMOMessage doToRemote(String endpoint, Object payload, Map messageProperties, boolean synchronous, int timeout)
           
protected  UMOMessage doToRemoteComponent(String component, Object payload, Map messageProperties, boolean synchronous)
           
 WireFormat getWireFormat()
           
 UMOMessage receiveRemote(String endpoint, int timeout)
           
 FutureMessageResult sendAsyncRemote(String endpoint, Object payload, Map messageProperties)
           
 FutureMessageResult sendAsyncToRemoteComponent(String component, String transformers, Object payload, Map messageProperties)
          sends an event to a components on a remote Mule instance, while making the result of the event trigger available as a Future result that can be accessed later by client code.
 UMOMessage sendRemote(String endpoint, Object payload, Map messageProperties)
           
 UMOMessage sendRemote(String endpoint, Object payload, Map messageProperties, int timeout)
           
 UMOMessage sendToRemoteComponent(String component, Object payload, Map messageProperties)
          sends an event synchronously to a components on a remote Mule instance.
protected  void setCredentials(UMOMessage message)
           
protected  void setExecutor(Executor e)
           
 void setWireFormat(WireFormat wireFormat)
           
protected  void updateContext(UMOMessage message, UMOEndpoint endpoint, boolean synchronous)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Log logger
logger used by this class

Constructor Detail

RemoteDispatcher

protected RemoteDispatcher(String endpoint,
                           UMOCredentials credentials)
                    throws UMOException

RemoteDispatcher

protected RemoteDispatcher(String endpoint)
                    throws UMOException
Method Detail

setExecutor

protected void setExecutor(Executor e)

dispatchToRemoteComponent

public void dispatchToRemoteComponent(String component,
                                      Object payload,
                                      Map messageProperties)
                               throws UMOException
Dispatcher an event asynchronously to a components on a remote Mule instance. Users can endpoint a url to a remote Mule server in the constructor of a Mule client, by default the default Mule server url tcp://localhost:60504 is used.

Parameters:
component - the name of the Mule components to dispatch to
payload - the object that is the payload of the event
messageProperties - any properties to be associated with the payload. as null
Throws:
UMOException - if the dispatch fails or the components or transfromers cannot be found

sendToRemoteComponent

public UMOMessage sendToRemoteComponent(String component,
                                        Object payload,
                                        Map messageProperties)
                                 throws UMOException
sends an event synchronously to a components on a remote Mule instance. Users can endpoint a url to a remote Mule server in the constructor of a Mule client, by default the default Mule server url tcp://localhost:60504 is used.

Parameters:
component - the name of the Mule components to send to
payload - the object that is the payload of the event
messageProperties - any properties to be associated with the payload. as null
Returns:
the result message if any of the invocation
Throws:
UMOException - if the dispatch fails or the components or transfromers cannot be found

sendAsyncToRemoteComponent

public FutureMessageResult sendAsyncToRemoteComponent(String component,
                                                      String transformers,
                                                      Object payload,
                                                      Map messageProperties)
                                               throws UMOException
sends an event to a components on a remote Mule instance, while making the result of the event trigger available as a Future result that can be accessed later by client code. Users can endpoint a url to a remote Mule server in the constructor of a Mule client, by default the default Mule server url tcp://localhost:60504 is used.

Parameters:
component - the name of the Mule components to send to
transformers - a comma separated list of transformers to apply to the result message
payload - the object that is the payload of the event
messageProperties - any properties to be associated with the payload. as null
Returns:
the result message if any of the invocation
Throws:
UMOException - if the dispatch fails or the components or transfromers cannot be found

sendRemote

public UMOMessage sendRemote(String endpoint,
                             Object payload,
                             Map messageProperties,
                             int timeout)
                      throws UMOException
Throws:
UMOException

sendRemote

public UMOMessage sendRemote(String endpoint,
                             Object payload,
                             Map messageProperties)
                      throws UMOException
Throws:
UMOException

dispatchRemote

public void dispatchRemote(String endpoint,
                           Object payload,
                           Map messageProperties)
                    throws UMOException
Throws:
UMOException

sendAsyncRemote

public FutureMessageResult sendAsyncRemote(String endpoint,
                                           Object payload,
                                           Map messageProperties)
                                    throws UMOException
Throws:
UMOException

receiveRemote

public UMOMessage receiveRemote(String endpoint,
                                int timeout)
                         throws UMOException
Throws:
UMOException

asyncReceiveRemote

public FutureMessageResult asyncReceiveRemote(String endpoint,
                                              int timeout)
                                       throws UMOException
Throws:
UMOException

doToRemoteComponent

protected UMOMessage doToRemoteComponent(String component,
                                         Object payload,
                                         Map messageProperties,
                                         boolean synchronous)
                                  throws UMOException
Throws:
UMOException

doToRemote

protected UMOMessage doToRemote(String endpoint,
                                Object payload,
                                Map messageProperties,
                                boolean synchronous,
                                int timeout)
                         throws UMOException
Throws:
UMOException

dispatchAction

protected UMOMessage dispatchAction(AdminNotification action,
                                    boolean synchronous,
                                    int timeout)
                             throws UMOException
Throws:
UMOException

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable

setCredentials

protected void setCredentials(UMOMessage message)

getWireFormat

public WireFormat getWireFormat()

setWireFormat

public void setWireFormat(WireFormat wireFormat)

updateContext

protected void updateContext(UMOMessage message,
                             UMOEndpoint endpoint,
                             boolean synchronous)
                      throws UMOException
Throws:
UMOException


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