Use the following instructions to create the XML_FlightQueryReply message flow. For more detailed instructions, click the links provided at the end of each step.
Before you create the XML_FlightQueryReply message flow, you must create the XML_FlightQueryOut message flow. For instructions, see Creating the XML_FlightQueryOut message flow.
To create and configure the XML_FlightQueryReply message flow:
Palette drawers | Node type | Node name |
---|---|---|
WebSphere MQ | MQInput | XML_FLIGHTQUERY_FLIGHT |
WebSphere MQ | MQInput | XML_FLIGHTQUERY_PASSENGERS |
WebSphere MQ | MQOutput | XML_FLIGHTQUERY_FAIL_1 |
WebSphere MQ | MQOutput | XML_FLIGHTQUERY_FAIL_2 |
WebSphere MQ | MQReply | MQMD_ReplyToQ |
Transformation | Compute | GetFlightDetails |
Transformation | Compute | GetPassengerDetails |
Node name | Terminal | Connect to |
---|---|---|
XML_FLIGHTQUERY_FLIGHT | Out | GetFlightDetails |
Catch | XML_FLIGHTQUERY_FAIL_1 | |
XML_FLIGHTQUERY_PASSENGERS | Out | GetPassengerDetails |
Catch | XML_FLIGHTQUERY_FAIL_2 | |
GetFlightDetails | Out | MQMD_ReplyToQ |
GetPassengerDetails | Out | MQMD_ReplyToQ |
Node name | Page | Property | Value |
---|---|---|---|
XML_FLIGHTQUERY_FLIGHT | Basic | Queue name | XML_FLIGHTQUERY_FLIGHT (This is the local queue from which the message flow takes the message.) |
Input Message Parsing | Message domain | XML : For XML messages (This tells the broker to use the generic XML parser.) |
|
XML_FLIGHTQUERY_PASSENGERS | Basic | Queue name | XML_FLIGHTQUERY_PASSENGERS (This is the local queue from which the message flow takes the message.) |
Input Message Parsing | Message domain | XML : For XML messages (This tells the broker to use the generic XML parser.) |
|
GetFlightDetails | Basic | Data source | RESERVDB (This is the database used by this node.) |
Basic | ESQL module | GetFlightDetails (This is the name of the ESQL module used by this node during processing. The name must match the name in the CREATE COMPUTE MODULE statement in the ESQL file.) |
|
GetPassengerDetails | Basic | Data source | RESERVDB (This is the database used by this node.) |
Basic | ESQL module | GetPassengerDetails (This is the name of the ESQL module used by this node during processing. The name must match the name in the CREATE COMPUTE MODULE statement in the ESQL file.) |
|
XML_FLIGHTQUERY_FAIL_1 | Basic | Queue name (You do not need to specify the name of the queue manager because the queue is defined on the same queue manager as the broker.) |
XML_FLIGHTQUERY_FAIL (This is where the message flow puts the message if the processing fails.) |
XML_FLIGHTQUERY_FAIL_2 | Basic | Queue name (You do not need to specify the name of the queue manager because the queue is defined on the same queue manager as the broker.) |
XML_FLIGHTQUERY_FAIL (This is where the message flow puts the message if the processing fails.) |
MQMD_ReplyToQ | You do not need to set any properties for this node. The node uses the ReplyToQ and the ReplyToQMgr fields in the MQMD header of the message. |
-- ************************************************ -- * ESQL for the XML_FlightQueryReply message flow -- ************************************************ CREATE COMPUTE MODULE GetFlightDetails CREATE FUNCTION Main() RETURNS BOOLEAN BEGIN SET OutputRoot = InputRoot; SET OutputRoot.XML.FlightQuery = NULL; CREATE FIELD OutputRoot.XML.Flight; DECLARE outflight REFERENCE TO OutputRoot.XML.Flight; DECLARE query REFERENCE TO InputRoot.XML.FlightQuery; -- populate the output message with flight info from the database SET OutputRoot.XML.Flight[] = (SELECT T.* FROM Database.XMLFLIGHTTB AS T WHERE T.FLIGHTNO = query.FlightNumber AND T.FLIGHTDATE = query.FlightDate); SET outflight.STARTPOINT = TRIM(outflight.STARTPOINT); SET outflight.ENDPOINT = TRIM(outflight.ENDPOINT); RETURN TRUE; END; END MODULE; CREATE COMPUTE MODULE GetPassengerDetails CREATE FUNCTION Main() RETURNS BOOLEAN BEGIN SET OutputRoot = InputRoot; SET OutputRoot.XML.FlightQuery = NULL; CREATE FIELD OutputRoot.XML.ListOfPassengers; DECLARE outpass REFERENCE TO OutputRoot.XML.ListOfPassengers; DECLARE query REFERENCE TO InputRoot.XML.FlightQuery; -- populate the output message with passenger info from the database SET outpass.PassengerDetails[] = (SELECT T.* FROM Database.XMLPASSENGERTB AS T WHERE T.FLIGHTNO = query.FlightNumber AND T.FLIGHTDATE = query.FlightDate); DECLARE I INTEGER 1; DECLARE J INTEGER CARDINALITY(outpass.*[]); WHILE I <= J DO SET outpass.PassengerDetails[I].LASTNAME = TRIM(outpass.PassengerDetails[I].LASTNAME); SET outpass.PassengerDetails[I].FIRSTNAME = TRIM(outpass.PassengerDetails[I].FIRSTNAME); SET I = I + 1; END WHILE; RETURN TRUE; END; END MODULE;