You are here: Home » Message Mapper » Pregenerated Classes » Methods of Mapping

Message Mapper: Mapping Class Methods

E-mail Print PDF

The base class provides the following convenience methods:

work()

Name work() This method is called directly after initializing the delegate to pass the required message structures. If it returns null the mapping will be suspended, if it returns a message-structure this will be forwarded as the result of the mapping.
Parameter - -
Return value Object The payload for the resulting message. It will be wrapped and forwarded to mule.


getContext()

Name getContext() This method can be used to retrieve the current MuleEventContext from a mapping.
Parameter - -
Return value MuleEventContext The MuleEventContext of the mapping


requestMessage()

Name requestMessage() This method requests a message from a specific channel. The used timeout is the default timeout of 10 seconds.
Parameter String... channelName The names of the channels from which a message should be requested. The method will block until each requested message has been received or timed out.
Return value int[] The count of received messages for each triggered channel.


requestMessage()

Name requestMessage() This method requests a message from a specific channel. The used timeout is the default timeout of 10 seconds.
Parameter int timeout The timeout for the triggering in milliseconds.
String... channelName The names of the channels from which a message should be requested. The method will block until each requested message has been received or timed out.
Return value int[] The count of received messages for each triggered channel.


sendAsyncResponse()

Name sendAsyncResponse() This method sends an asynchronous response to a previously received message using an AsyncReplyRouter. If a message should be returned to a synchronous endpoint it has to be returned by either startWork() or resumeWork().
Parameter MuleMessage originalMessage The message to which the response should be sent. It is used to get its unique ID and to set this to the response as correlation ID.
MuleMessage responseMessage The user generated message that should be sent as a response to the original message
Return value - -


sendAsyncResponse()

Name sendAsyncResponse() This method sends an asynchronous response to a previously received message using an AsyncReplyRouter. If a message should be returned to a synchronous endpoint it has to be returned by either startWork() or resumeWork().
Parameter Field responseMessage The user generated message that should be sent as a response to the original message
String correlationID The correlation ID of the original message
Return value - -


sendAsyncResponse()

Name sendAsyncResponse() This method sends an asynchronous response to a previously received message using an AsyncReplyRouter. If a message should be returned to a synchronous endpoint it has to be returned by either startWork() or resumeWork().
Parameter MuleMessage responseMessage The user generated message that should be sent as a response to the original message
String correlationID The correlation ID of the original message
Return value - -


sendAsyncResponse()

Name sendAsyncResponse() This method sends an asynchronous response to a previously received message using an AsyncReplyRouter. If a message should be returned to a synchronous endpoint it has to be returned by either startWork() or resumeWork().
Parameter Field originalMessage The message to which the response should be sent. It is used to get its unique ID and to set this to the response as correlation ID.
Field responseMessage The user generated message that should be sent as a response to the original message
Return value - -


sendAsyncResponse()

Name sendAsyncResponse() This method sends an asynchronous response to a previously received message using an AsyncReplyRouter. If a message should be returned to a synchronous endpoint it has to be returned by either startWork() or resumeWork().
Parameter MuleMessage responseMessage The user generated message that should be sent as a response to the original message
String correlationID the correlation ID of the original message.
String responsePath The path of the endpoint connected to an AsyncReplyRouter that can handle the response. Normally, this will be a VM-path but it can also be any path supported by the MuleEventContext.dispatchEvent(MuleMessage message, String path) method.
Return value - -


sendAsyncResponse()

Name sendAsyncResponse() This method sends an asynchronous response to a previously received message using an AsyncReplyRouter. If a message should be returned to a synchronous endpoint it has to be returned by either startWork() or resumeWork().
Parameter Field responseMessage The user generated message that should be sent as a response to the original message
String correlationID the correlation ID of the original message.
String responsePath The path of the endpoint connected to an AsyncReplyRouter that can handle the response. Normally, this will be a VM-path but it can also be any path supported by the MuleEventContext.dispatchEvent(MuleMessage message, String path) method.
Return value - -


dispatchMessage()

Name dispatchMessage() This method dispatches (asynchronously) a Saddle message using the mule infrastructure. It should be used when handling multiple output message-structures which may then be filtered and handled by mule (e.g. by passing them on to a filtering router).
Parameter MuleMessage message The message that should be sent to the destination channel.
Return value - -


dispatchMessage()

Name dispatchMessage() This method dispatches (asynchronously) a Mule message using the mule infrastructure. It should be used when handling multiple output message-structures which may then be filtered and handled by mule (e.g. by passing them on to a filtering router).
Parameter MuleMessage message The Mule message object that should be sent to the destination channel
String endpointName The endpoint name to dispatch the event through
Return value - -


dispatchMessage()

Name dispatchMessage() This method dispatches (asynchronously) a Saddle message using the mule infrastructure. It should be used when handling multiple output message-structures which may then be filtered and handled by mule (e.g. by passing them on to a filtering router).
Parameter Field message The message that should be sent to the destination channel. It will be transformed into a MuleMessage object and then sent out.
Return value - -


dispatchMessage()

Name dispatchMessage() This method dispatches (asynchronously) a Mule message using the mule infrastructure. It should be used when handling multiple output message-structures which may then be filtered and handled by mule (e.g. by passing them on to a filtering router).
Parameter Field message The message that should be sent to the destination channel. It will be trans-formed into a MuleMessage object and then sent out.
String endpointName The endpoint name to dispatch the event through
Return value - -


writeToLookup()

Name writeToLookup() This function provides a convenient way to store arbitrary objects in a local lookup. It should be used if a field has to be accessed multiple times, as it is much faster than always retrieving it from the message-structure. The lookup table should store the reference to the field. But also any other object can be stored in this table. The combination of category and ID has to be unique. If another object is stored under the same category and id combination, the formerly stored object is overwritten.
Parameter String category The category under which the object should be stored. The user can freely assign any string as a category to an object. Categories allow to group objects. That way, an id has to be only unique within an category.
String id The id under which the object should be stored. The user can freely assign any string as an id to an object. The reason for the id is the identification of the object in the lookup table at the time of retrieval.
Object value The object that has to be stored in the table.
Return value - -


readFromLookup()

Name readFromLookup() Obtains a previously stored object from the local lookup table. This object is identified by a category and an id.
Parameter String category The category under which the object has been stored. The user can freely assign any string as category to an object.
String id The id under which the object has been stored. The user can freely assign any string as an id to an object.
Return value Object The object that corresponds to the provided category and object or null if no object could be identified.


In addition Saddle generates a getter for each channel
getChannelName()

Name getChannelName() This method gets the current instance of the channel named ChannelName.
Parameter - -
Return value Field or MuleMessage (Depending on the channel) The current instance of the channel ChannelName if there is one or null if there is none.