WebSphere Message Brokers
File: ar25251_3_
Writer: Cerys Giddings

Task topic

This build: July 31, 2007 21:36:24

Develop a message flow to map target fields from multiple other fields

Before you start
Perform the steps in the following topic:
  1. Develop a message flow that contains other nodes
This is the third stage of the scenario to perform complex message enrichment. This topic demonstrates how to develop a message flow to map target fields from multiple other fields and also involves developing corresponding message models and instance documents.
  1. In the COMPLEX message definition, in namespace www.complex.net, create a message called addev2, which has the following structure:
    addev2
       firstname             (xsd:string) local element
       lastname              (xsd:string) local element
       branch                 (xsd:string) local element
       accountno            (xsd:string) local element
       balance                (xsd:decimal) local element
       transvalue             local complex element, base type xsd:decimal
          transdir             (xsd:string) local attribute
  2. In the message set MAPPING3_COMPLEX_messages, create a new message definition file called COMP2, which has the target namespace www.comp2.net, with prefix c2.
  3. In the COMP2 message definition, create a message called addev2out, which has the structure:
    addev2out
        accountdetails      (xsd:string) local element
        transvalue            (xsd:decimal) local element
        balance                (xsd:decimal) local element
  4. Create a message flow called addev2, which contains the following mapping: MQInput -> Mapping -> MQOutput.
  5. Open the map and select addev2 as the source and addev2out as the target.
  6. Wire the source to target as shown:
    accountno --- accountdetails
    balance --- balance
    transvalue --- transvalue
  7. In the Spreadsheet pane, expand Properties and set the following values:
    MessageType   |     'addev2out'
  8. Set the accountdetails target to fn:concat($source/comp:addev2/accountno, $source/comp:addev2/branch, $source/comp:addev2/lastname, $source/comp:addev2/firstname).
  9. Right-click the target transvalue and click If.
  10. Change the condition from fn:true() to $source/comp:addev2/transvalue/@transdir = 'DEBIT'.
  11. Select transvalue and set its value to $source/comp:addev2/transvalue * (-1).
  12. Right-click the condition and click Else.
  13. Right-click the target balance and click If.
  14. Change the condition from fn:true() to $source/comp:addev2/transvalue/@transdir = 'DEBIT'.
  15. Select balance and set its value to $source/comp:addev2/balance - $source/comp:addev2/transvalue.
  16. Right-click the condition and click Condition.
  17. Change the condition from fn:true() to $source/comp:addev2/transvalue/@transdir = 'CREDIT'.
  18. Select balance following the second condition and set its Value to $source/comp:addev2/balance + $source/comp:addev2/transvalue.
  19. Create two instance messages with the appropriate RFH2 headers:
    <comp:addev2 xmlns:comp="http://www.complex.net">
    <firstname>Brian</firstname>
    <lastname>Benn</lastname>
    <branch>52-84-02</branch>
    <accountno>567432876543</accountno>
    <balance>1543.56</balance>
    <transvalue transdir="DEBIT">25.28</transvalue>
    </comp:addev2>
    <comp:addev2 xmlns:comp="http://www.complex.net">
    <firstname>Brian</firstname>
    <lastname>Benn</lastname>
    <branch>52-84-02</branch>
    <accountno>567432876543</accountno>
    <balance>1543.56</balance>
    <transvalue transdir="CREDIT">25.28</transvalue>
    </comp:addev2>
You have created the following resources:
Now deploy the message set and message flow

Deploy the message set and message flow

This is the fourth stage of the scenario to perform complex message enrichment. This topic demonstrates how to deploy the message set and message flow and run the instance messages through the broker.
  1. Create a bar file called addev2.
  2. Add the message set MAPPING3_COMPLEX_messages and the message flow addev2 to the bar file.
  3. Deploy the bar file to the broker.
  4. Put the instance documents on the input queue.
The output messages look like this:
<c2:addev2out xmlns:c2="http://www.comp2.net"  xmlns:comp="http://www.complex.net">
<accountdetails>567432876543 52-84-02 Benn Brian</accountdetails>
<transvalue>-25.28</transvalue>
<balance>1518.28</balance>
</c2:addev2out>
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:36:24

ar25251_3_ This topic's URL is: