|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.extras.client.MuleClient
MuleClient
is a simple interface for Mule clients to send and receive
events from a Mule Server. In most Mule applications events are triggered by
some external occurrence such as a messge being received on a queue or file being copied
to a directory. The Mule client allows the user to send and receive events programmatically
through its Api.
MuleManager.getInstance()
MuleEndpointURI
Field Summary | |
protected static Log |
logger
logger used by this class |
Constructor Summary | |
MuleClient()
Creates a default Mule client that will use the default serverEndpoint to connect to a remote server instance. |
|
MuleClient(java.lang.String configResources)
Configures a Mule CLient instance using the the default MuleXmlConfigurationBuilder to parse the config resources |
|
MuleClient(java.lang.String configResources,
ConfigurationBuilder builder)
Configures a Mule CLient instance |
|
MuleClient(java.lang.String configResources,
ConfigurationBuilder builder,
java.lang.String user,
java.lang.String password)
Configures a Mule CLient instance |
|
MuleClient(java.lang.String user,
java.lang.String password)
Configures a new MuleClient and either uses an existing Manager running in this JVM or creates a new empty manager |
Method Summary | |
void |
dispatch(java.lang.String url,
java.lang.Object payload,
java.util.Map messageProperties)
Dispatches an event asynchronously to a endpointUri via a mule server. |
void |
dispatchDirect(java.lang.String component,
java.lang.Object payload,
java.util.Map messageProperties)
dispatches an event asynchronously to the components |
void |
dispose()
Will dispose the MUleManager instance *IF* a new instance was created for this client. |
protected UMOEndpoint |
getDefaultClientEndpoint(UMODescriptor descriptor,
java.lang.Object payload)
|
protected UMOEvent |
getEvent(UMOMessage message,
UMOEndpointURI uri,
boolean synchronous)
Packages a mule event for the current request |
UMOManager |
getManager()
Overriding methods may want to return a custom manager here |
java.lang.Object |
getProperty(java.lang.Object key)
|
RemoteDispatcher |
getRemoteDispatcher(java.lang.String serverEndpoint)
|
RemoteDispatcher |
getRemoteDispatcher(java.lang.String serverEndpoint,
java.lang.String user,
java.lang.String password)
|
UMOMessage |
receive(java.lang.String url,
long timeout)
Will receive an event from an endpointUri determined by the url |
UMOMessage |
receive(java.lang.String url,
java.lang.String transformers,
long timeout)
Will receive an event from an endpointUri determined by the url |
UMOMessage |
receive(java.lang.String url,
UMOTransformer transformer,
long timeout)
Will receive an event from an endpointUri determined by the url |
void |
registerComponent(java.lang.Object component,
java.lang.String name,
MuleEndpointURI listenerEndpoint)
Registers a java object as a Umo pcomponent that listens for events on the given url. |
void |
registerComponent(java.lang.Object component,
java.lang.String name,
MuleEndpointURI listenerEndpoint,
MuleEndpointURI sendEndpoint)
Registers a java object as a Umo pcomponent that listens for and sends events on the given urls. |
void |
registerComponent(UMODescriptor descriptor)
Registers a user configured MuleDescriptor of a components to the server. |
UMOMessage |
send(java.lang.String url,
java.lang.Object payload,
java.util.Map messageProperties)
Sends an event synchronously to a endpointUri via a mule server and a resulting message is returned. |
UMOMessage |
send(java.lang.String url,
java.lang.Object payload,
java.util.Map messageProperties,
int timeout)
Sends an event synchronously to a endpointUri via a mule server and a resulting message is returned. |
FutureMessageResult |
sendAsync(java.lang.String url,
java.lang.Object payload,
java.util.Map messageProperties)
sends an event request to a Url, making the result of the event trigger available as a Future result that can be accessed later by client code. |
FutureMessageResult |
sendAsync(java.lang.String url,
java.lang.Object payload,
java.util.Map messageProperties,
int timeout)
sends an event request to a Url, making the result of the event trigger available as a Future result that can be accessed later by client code. |
UMOMessage |
sendDirect(java.lang.String component,
java.lang.String transformers,
java.lang.Object payload,
java.util.Map messageProperties)
sends an event synchronously to a components |
FutureMessageResult |
sendDirectAsync(java.lang.String component,
java.lang.String transformers,
java.lang.Object payload,
java.util.Map messageProperties)
sends an event to a components on a local Mule instance, while making the result of the event trigger available as a Future result that can be accessed later by client code. |
void |
sendNoReceive(java.lang.String url,
java.lang.Object payload,
java.util.Map messageProperties)
Sends an event synchronously to a endpointUri via a mule server without waiting for the result. |
void |
setProperty(java.lang.Object key,
java.lang.Object value)
|
void |
unregisterComponent(java.lang.String name)
Unregisters a previously register components. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static transient Log logger
Constructor Detail |
public MuleClient() throws UMOException
UMOException
public MuleClient(java.lang.String configResources) throws UMOException
configResources
- a config resource location to configure this client with
ConfigurationException
- is there is a MuleManager instance already
running in this JVM or if the builder fails to configure the Manager
UMOException
public MuleClient(java.lang.String user, java.lang.String password) throws UMOException
user
- the username to use when connecting to a remote server instancepassword
- the password for the user
UMOException
public MuleClient(java.lang.String configResources, ConfigurationBuilder builder) throws ConfigurationException
configResources
- a config resource location to configure this client withbuilder
- the configuration builder to use
ConfigurationException
- is there is a MuleManager instance already
running in this JVM or if the builder fails to configure the Managerpublic MuleClient(java.lang.String configResources, ConfigurationBuilder builder, java.lang.String user, java.lang.String password) throws ConfigurationException
configResources
- a config resource location to configure this client withbuilder
- the configuration builder to useuser
- the username to use when connecting to a remote server instancepassword
- the password for the user
ConfigurationException
- is there is a MuleManager instance already
running in this JVM or if the builder fails to configure the ManagerMethod Detail |
public void dispatch(java.lang.String url, java.lang.Object payload, java.util.Map messageProperties) throws UMOException
url
- the Mule url used to determine the destination and transport of the messagepayload
- the object that is the payload of the eventmessageProperties
- any properties to be associated with the payload. In the case of Jms you could
set the JMSReplyTo property in these properties.
UMOException
public UMOMessage sendDirect(java.lang.String component, java.lang.String transformers, java.lang.Object payload, java.util.Map messageProperties) throws UMOException
component
- the name of the Mule components to send totransformers
- a comma separated list of transformers to apply to the result messagepayload
- the object that is the payload of the eventmessageProperties
- any properties to be associated with the payload.
as null
UMOException
- if the dispatch fails or the components or transfromers cannot be foundpublic void dispatchDirect(java.lang.String component, java.lang.Object payload, java.util.Map messageProperties) throws UMOException
component
- the name of the Mule components to dispatch topayload
- the object that is the payload of the eventmessageProperties
- any properties to be associated with the payload.
as null
UMOException
- if the dispatch fails or the components or transfromers cannot be foundpublic FutureMessageResult sendAsync(java.lang.String url, java.lang.Object payload, java.util.Map messageProperties) throws UMOException
url
- the url to make a request onpayload
- the object that is the payload of the eventmessageProperties
- any properties to be associated with the payload.
as null
UMOException
- if the dispatch fails or the components or transfromers cannot be foundpublic FutureMessageResult sendAsync(java.lang.String url, java.lang.Object payload, java.util.Map messageProperties, int timeout) throws UMOException
url
- the url to make a request onpayload
- the object that is the payload of the eventmessageProperties
- any properties to be associated with the payload.
as nulltimeout
- how long to block in milliseconds waiting for a result
UMOException
- if the dispatch fails or the components or transfromers cannot be foundpublic FutureMessageResult sendDirectAsync(java.lang.String component, java.lang.String transformers, java.lang.Object payload, java.util.Map messageProperties) throws UMOException
component
- the name of the Mule components to send totransformers
- a comma separated list of transformers to apply to the result messagepayload
- the object that is the payload of the eventmessageProperties
- any properties to be associated with the payload.
as null
UMOException
- if the dispatch fails or the components or transfromers cannot be foundpublic UMOMessage send(java.lang.String url, java.lang.Object payload, java.util.Map messageProperties) throws UMOException
url
- the Mule url used to determine the destination and transport of the messagepayload
- the object that is the payload of the eventmessageProperties
- any properties to be associated with the payload. In the case of Jms you could
set the JMSReplyTo property in these properties.
UMOException
public UMOMessage send(java.lang.String url, java.lang.Object payload, java.util.Map messageProperties, int timeout) throws UMOException
url
- the Mule url used to determine the destination and transport of the messagepayload
- the object that is the payload of the eventmessageProperties
- any properties to be associated with the payload. In the case of Jms you could
set the JMSReplyTo property in these properties.timeout
- The time in milliseconds the the call should block waiting for a response
UMOException
public UMOMessage receive(java.lang.String url, long timeout) throws UMOException
url
- the Mule url used to determine the destination and transport of the messagetimeout
- how long to block waiting to receive the event, if set to 0 the receive will
not wait at all and if set to -1 the receive will wait forever
UMOException
public UMOMessage receive(java.lang.String url, java.lang.String transformers, long timeout) throws UMOException
url
- the Mule url used to determine the destination and transport of the messagetransformers
- A comma separated list of transformers used to apply to the result messagetimeout
- how long to block waiting to receive the event, if set to 0 the receive will
not wait at all and if set to -1 the receive will wait forever
UMOException
public UMOMessage receive(java.lang.String url, UMOTransformer transformer, long timeout) throws UMOException
url
- the Mule url used to determine the destination and transport of the messagetransformer
- A transformer used to apply to the result messagetimeout
- how long to block waiting to receive the event, if set to 0 the receive will
not wait at all and if set to -1 the receive will wait forever
UMOException
protected UMOEvent getEvent(UMOMessage message, UMOEndpointURI uri, boolean synchronous) throws UMOException
message
- the event payloaduri
- the destination endpointUrisynchronous
- whether the event will be synchronously processed
UMOException
protected UMOEndpoint getDefaultClientEndpoint(UMODescriptor descriptor, java.lang.Object payload) throws UMOException
UMOException
public void sendNoReceive(java.lang.String url, java.lang.Object payload, java.util.Map messageProperties) throws UMOException
url
- the Mule url used to determine the destination and transport of the messagepayload
- the object that is the payload of the eventmessageProperties
- any properties to be associated with the payload. In the case of Jms you could
set the JMSReplyTo property in these properties.
UMOException
public UMOManager getManager()
public void registerComponent(java.lang.Object component, java.lang.String name, MuleEndpointURI listenerEndpoint) throws UMOException
component
- any java object, Mule will it's endpointUri discovery to determine
which event to invoke based on the evnet payload typename
- The identifying name of the components. This can be used to later unregister itlistenerEndpoint
- The url endpointUri to listen to
UMOException
public void registerComponent(java.lang.Object component, java.lang.String name, MuleEndpointURI listenerEndpoint, MuleEndpointURI sendEndpoint) throws UMOException
component
- any java object, Mule will it's endpointUri discovery to determine
which event to invoke based on the evnet payload typename
- The identifying name of the components. This can be used to later unregister itlistenerEndpoint
- The url endpointUri to listen tosendEndpoint
- The url endpointUri to dispatch to
UMOException
public void registerComponent(UMODescriptor descriptor) throws UMOException
MyBean implementation = new MyBean();
descriptor.setImplementationInstance(implementation);
Calling this method is equivilent to calling UMOModel.registerComponent(..)
descriptor
- the componet descriptor to register
UMOException
- the descriptor is invalid or cannot be initialised or startedUMOModel
public void unregisterComponent(java.lang.String name) throws UMOException
name
- the name of the componet to unregister
UMOException
- if unregistering the components fails, i.e. The underlying
transport fails to unregister a listener. If the components does not exist, this
method should not throw an exception.UMOModel
public RemoteDispatcher getRemoteDispatcher(java.lang.String serverEndpoint) throws MalformedEndpointException
MalformedEndpointException
public RemoteDispatcher getRemoteDispatcher(java.lang.String serverEndpoint, java.lang.String user, java.lang.String password) throws MalformedEndpointException
MalformedEndpointException
public void dispose()
dispose
in interface Disposable
public void setProperty(java.lang.Object key, java.lang.Object value)
public java.lang.Object getProperty(java.lang.Object key)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |