Coding Output Mappers

In between the BeginOutboundMapper and EndOutboundMapper nodes, the mapper developer must implement the mapping from ISF to the target format. The input message, from the BeginOutboundMapper node, is the event that triggered the calling of the mapper action. The parsed ISF for the transactions to be mapped is located in the environment tree shown in Table 1.

The output, to the EndOutboundMapper node, must be the mapped output message in the desired format. The mapper developer does not need to perform any database persistence or raise any events; the EndOutboundMapper component does this.

The mapper developer only needs to perform the following task:
  1. Map the message from ISF to the output format.
    Note: It is recommended to use XMLNSC for all ISF message tree manipulation.
The mapper developer has a number of main options for implementing a mapping:
  • Using ESQL code in a compute node.
  • Calling out to a Java™ procedure from a compute node.
  • Using a Java compute node.
  • Using an XML Transformation node (XSL-T).
  • Using a mapping node.
  • Using a IBM® Transformation Extender plug-in node.
Notes:
  1. Using an XML transformation node with non-XML data can negatively affect performance because extra parse/write steps are required to convert the data to and from XML.
  2. A mapping node is probably only useful for very straightforward mappings. For any complicated mappings it is probably best that they are implemented using code; ESQL or Java, for example.
  3. Because the source ISF is in the environment tree and not in the input message tree, using a mapping node or an XML transformation node first requires the ISF message to be copied from the environment and put into the main message tree. This can be done by using a compute node with the necessary ESQL code prior to the mapping or XML Transformation node.

The output mapper has access to the information shown in the following table. In addition, as the output mapper is called in the context of an FSM action (A_MapAndPutPTToQueue or A_RouteAndSendOutTxn), all of the action data described in Action Context Data is also available to an output mapper.

The output mapper may override settings, such as CCSID and ENCODING, that have been retrieved from the channel table. The overridden values are used by the EndOutboundMapper when creating the bit stream. If CCSID or ENCODING are not present, or set to zero, the queue manager defaults apply.

Similarly, an output mapper may wish to set specific IBM MQ header values. In the case of the sample application, the output mapper for SWIFT 103 messages sets the object ID of the new physical transmission into the MQMD MsgId and CorrelId fields. These are used to correlate responses with this message when the response is returned to FTM.

Table 1. Output mapper context data
Location Contents
InputBody Parsed event message that triggered the output mapper
Environment.PMP.Variables.Rules. {MapperName}.PhysicalTransmissionID The unique identifier of the outbound physical transmission that is being mapped
Environment.PMP.Variables.Rules. {MapperName}.Channel The details of the channel on which the outbound message is sent.

The channel properties available beneath this location are the same as those used by the input mapper. They are listed in Input mapper context data.

Environment.PMP.Variables.Rules. {MapperName}.Transaction[] Array of transactions in the outbound physical transmission. These are to be mapped to the target format.
The following fields are available at the transaction level:
ID
Object ID
TXN_ID
Transaction ID
TYPE
Transaction type
ISF_DATA
The unparsed ISF valid representation of the transaction
Environment.PMP.Variables.Rules. {MapperName}.Transaction[].{ISF_DOMAIN} The parsed ISF representation of the transaction. This is what will be mapped to the target format. The value of {ISF_DOMAIN} will come from the ISF record in the format table and ideally would be XMLNSC for new mappers or maybe MRM for legacy mappers.
Environment.PMP.Variables. Mapper.Errors[] An array of error objects that were created during the mapping. These need not be fatal errors, that is, it may be able to continue mapping after adding an error to this array.
The error object has the following fields:
  • Type
  • Description
  • objID

If the error is related to a specific transaction, the unique transaction identifier should be set in the objID field. Otherwise, the error is logged against the physical transmission.

Environment.PMP.Variables. Mapper.Result The result of the mapping. Valid results are:
  • Success
  • Failure
  • Aborted
OutputRoot The output message, in the required target format, is built here