This is the first stage of the scenario to
use
a broker as an auditor. This topic demonstrates how to develop a message
flow to map several fields of input data into a single insert record for a
database. It also involves updating another table and deleting a third table,
as well as developing corresponding message models and instance messages.
- Create a database called MAPDB and a table called CONFIRMATION,
which contains the following columns:
RESID INTEGER
- Populate the CONFIRMATION table with the value shown:
9052
- Create another table called RESERVATION, which contains the following
columns:
RESID INTEGER
NAME VARCHAR(20)
PARTY INTEGER
PAYMENT DECIMAL(8,2)
- Populate the RESERVATION table with the values shown:
8214,'ARCHIBALD',2,0.0
2618,'HENRY', 4, 120.0
9052,'THAW', 3, 85.0
- Create another table called PROVISIONAL, which contains the following
columns:
RESID INTEGER
- Populate the PROVISIONAL table with the values shown:
8214 2618
- Create a Windows ODBC Data
Source Name for the database, and register the database with the Configuration
Manager by
clicking .
- Create a message set project and a message set called MAPPING3_AUDIT_messages
(ensuring that the message set is namespace enabled, with XML wire format)
and create a message definition file called AUDIT.
- Create a message called addev1, which has the structure:
addev1
id (xsd:int) local element
status (xsd:string) local element
name (xsd:string) local element
size (xsd:int) local element
payment (xsd:decimal) local element
- Create a message flow project called MAPPING3_AUDIT_flows.
- Create a message flow called addev1, which contains the following
mapping: MQInput ->DataInsert -> DataUpdate -> DataDelete -> MQOutput.
- For the DataInsert node, set the Data Source property to MAPDB.
- Open the mapping for the DataInsert node and select MAPPING3_AUDIT_messages
addev1 as the source, and MAPDB.SCHEMA.CONFIRMATION as the target.
- Wire the source to the target as shown:
addev1 MAPDB
id -------------- RESID
- For the DataUpdate node, set the Data Source property to MAPDB.
- Open the mapping for the DataUpdate node and select MAPPING3_AUDIT_messages
addev1 as the source, and MAPDB.SCHEMA.RESERVATION as the target.
- Wire the source to the target as shown:
addev1 MAPDB
id -------------- RESID
name ---------- NAME
size ------------ PARTY
payment ------- PAYMENT
- In the Spreadsheet pane, select $db:update and change fn:true()
to $db:update.MAPDB.MQSI.RESERVATION.RESID = $source/addev1/id and $source/addev1/status
= 'CONFIRM'.
- For the DataDelete node, set the Data Source property to MAPDB.
- Open the mapping for the DataDelete node and select MAPPING3_AUDIT_messages
addev1 as the source, and MAPDB.SCHEMA.PROVISIONAL as the target.
- In the Spreadsheet pane, select $db:delete and change fn:false()
to $db:delete.MAPDB.MQSI.PROVISIONAL.RESID = $source/addev1/id.
- Create the following instance message with appropriate RFH2 headers:
<addev1>
<id>8214</id>
<status>CONFIRM</status>
<name>ARCHIBALD</name>
<size>2</size>
<payment>1038.0</payment>
</addev1>