You are here: Home » Tutorial » Message Mapping

Message Mapping

E-mail Print PDF
Article Index
Message Mapping
Create the mapping logic
Map the customer name
Identify the billing and shipping address
Map the addresses
Complete the customer details
Map the ordered items
Set the total value of the order
Send the purchase message
Save and deploy the mapping
All Pages

 

 

The structure of the order message of the reseller’s ERP system has to be mapped to the purchase message that is expected by the ERP system of the producer. Mule does this in a so-called service component.

The Message Mapper allows the creation of the business logic that implements the mapping for this business component.

Start the Message Mapper

To create a mapping that matches your current service component simply select it. As soon as the component is selected its properties will be shown in the property panels in the lower right of the screen.


Click the "..." button 1_small to create a new Mapping.

createnewmapping

This opens the following wizard that helps you create a mapping.

 mappingwizard

The table “Source Channels” contains information about the inbound channels of the mapping. Those information comprise the name of the inbound message channel, the path to the message structure template that is used by this channel and the name of the endpoint from which the messages are sent to this channel.

There is also a checkbox that can be marked if a channel has to be triggered by the business logic. This will not be the case in our example, so this box remains unchecked.

The table “Destination Channels” contains the channel information for the outbound messages of the business logic. The difference to the inbound channels is that no outbound endpoint has to be specified as Mule bases the decision concerning which endpoint an outbound message will be directed on the outbound routers that are applied to the service.

As the wizard is already pre-filled we only have to set the template "Purchase" on the outbound channel as this can not be read from the configuration file.

Select the template "Purchase" for the outgoing channel "PurchaseSystemProvider".

selectouttemplate

We will now rename the channels to have nicer names in the mapping code later.


  1. Rename the channel "OrderSystemReseller" to "Order".
  2. Rename the channel "PurchaseSystemProducer" to "Purchase".
  3. Click "OK" to create the mapping.

To open the new mapping simply double click the business logic file named "MapOrderToPurchase" in the subtree of the mapping.

mappingsubtree

Open the mapping's business logic by double clicking "MapOrderToPurchase"