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:
Node type | Node name |
---|---|
MQInput | XML_FLIGHTQUERY_FLIGHT |
MQInput | XML_FLIGHTQUERY_PASSENGERS |
MQOutput | XML_FLIGHTQUERY_FAIL_1 |
MQOutput | XML_FLIGHTQUERY_FAIL_2 |
MQReply | MQMD_ReplyToQ |
Compute | GetFlightDetails |
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.) |
Default | Message Domain | XML (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.) |
Default | Message Domain | XML (This tells the broker to use the generic XML parser.) |
|
Get Flight Details | 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.) |
|
Get Passenger Details | 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;
You have now created the XML_FlightQueryReply message flow, which is the aggregate reply part of the XML_FlightQuery message flow. The XML_FlightQueryReply message flow works with the XML_FlightQueryOut and XML_FlightQueryIn message flows to request information about a specific flight and the passengers who have reserved seats on that flight.