To save the user from having to deal with simultaneously arriving messages, to allow for triggering messages over the mule infrastructure, and to make handling mappings easier in general, a framework for the Message Mapper has been created. It waits for required messages and handles requests with a timeout. The base class automatically assigns received messages to queues and calls the user code once all required messages have arrived. It also handles stopping the processing of a message if necessary or forwarding return values using the mule infrastructure.
This framework will be generated automatically upon creation of a new message mapping.
The user only has to implement the business logic in a custom class, which is derived from the base class. By default it only contains a method work() but the user can add arbitrary methods to it. As soon as all required messages have arrived the Mapping will call the method work().
All required messages will be available using their getters. If other messages are needed that have to be requested this can be achieved by calling the requestMessage() method. This call will block until either all requested messages have arrived or the timeout has been reached. The user has to check the return values of this method and obtain the requested messages by using their getter methods.
The following sub-sections explain the pregenerated functions of both classes.
< Prev | Next > |
---|