This is the seventh stage of the scenario to perform
simple
message enrichment. This topic demonstrates how to develop a message
flow for populating a target from a database. It also involves developing
a corresponding message model and instance documents.
- Create a database called MAPDB and create a table called TRANSACTION,
which has the following columns:
ACCOUNT VARCHAR(12)
TDATE DATE
VALUE DECIMAL(8,2)
- Populate the database with the values shown:
'12345678901', '2005-04-25', -14.25
'12345678901', '2005-04-25', 100.00
'12345678901','2005-05-15', 2891.30
'12345678901','2005-06-11', -215.28
- Create a Windows ODBC Data
Source Name for the database and then register the database with the Configuration
Manager by
clicking .
- In the COMPLEX message definition, in namespace www.complex.net,
create a message called addev4in, which has the following structure:
addev4in
account (xsd:string) local element
tdate (xsd:date) local element
- In the COMP2 message definition, in namespace www.comp2.net, create
a message called addev4out, which has the following structure:
addev4out
account (xsd:string) local element
tdate (xsd:date) local element
value (xsd:decimal) local element, minOcc=0, maxOcc=-1
- Create a message flow called addev4, which contains the following
mapping: MQInput > Mapping > MQOutput.
- Open the map and select addev4in as the source and addev4out as
the target.
- Map the input to outputs as shown:
account --- account
tdate --- tdate
- In the Spreadsheet pane, right-click the target value and click Select
Data Source.
- Select MAPDB from the dialog box and click Finish.
- In the top pane, expand the MAPDB tree and wire the values as shown:
VALUE --- value
- In the Spreadsheet pane, select the target $db:select and change
fn:true() to: $db:select.MAPDB.SCHEMA.TRANSACTION.ACCOUNT=$source/comp:addev4in/account and $db:select.MAPDB.SCHEMA.TRANSACTION.TDATE=$source/comp:addev4in/tdate
- Expand the Properties tree and set the following values:
MessageType | 'addev4out'
- Set the data source property for the Mapping node to MAPDB.
- Create the following instance messages with appropriate RFH2 headers:
<comp:addev4in xmlns:comp="http://www.complex.net">
<account>12345678901</account>
<tdate>2005-05-15</tdate>
</comp:addev4in>
<comp:addev4in xmlns:comp="http://www.complex.net">
<account>12345678901</account>
<tdate>2005-04-25</tdate>
</comp:addev4in>
Now deploy the message set and message flow.