Use the following instructions to create the XML_PassengerQuery message flow. For more detailed instructions, click the links provided at the end of each step.
To create and configure the XML_PassengerQuery message flow:
Palette drawers | Node type | Node name |
---|---|---|
WebSphere MQ | MQInput | XML_PASSENGERQUERY_IN |
WebSphere MQ | MQOutput | XML_PASSENGERQUERY_OUT |
WebSphere MQ | MQOutput | XML_PASSENGERQUERY_FAIL_1 |
WebSphere MQ | MQOutput | XML_PASSENGERQUERY_FAIL_2 |
Transformation | Compute | DecideOnQuery |
Transformation | Compute | GetPassengerInformation |
Transformation | Compute | GetReservationsInformation |
Routing | Label | SinglePassenger |
Routing | Label | AllReservations |
Routing | RouteToLabel | RouteToLabel |
The RouteToLabel node dynamically routes the message according to the contents of the LocalEnvironment that is associated with the message. The LocalEnvironment contains the identity of one or more target Label nodes which are identified by their Label Name property (not the node name).
Node name | Terminal | Connect to |
---|---|---|
XML_PASSENGERQUERY_IN | Failure | XML_PASSENGERQUERY_FAIL_1 |
Out | DecideOnQuery | |
Catch | XML_PASSENGERQUERY_FAIL_2 | |
DecideOnQuery | Out | RouteToLabel |
SinglePassenger | Out | GetPassengerInformation |
AllReservations | Out | GetReservationsInformation |
GetPassengerInformation | Out | XML_PASSENGERQUERY_OUT |
GetReservationsInformation | Out | XML_PASSENGERQUERY_OUT |
Node name | Page | Property | Value |
---|---|---|---|
XML_PASSENGERQUERY_IN | Basic | Queue name | XML_PASSENGERQUERY_IN (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_PASSENGERQUERY_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_PASSENGERQUERY_FAIL (This is the local queue on which the message flow puts the message if the processing fails.) |
XML_PASSENGERQUERY_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_PASSENGERQUERY_FAIL (This is the local queue on which the message flow puts the message if the processing fails.) |
DecideOnQuery | Basic | ESQL module | DecideOnQuery (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.) |
Basic | Compute mode | LocalEnvironment and Message (This causes the LocalEnvironment as well as the message to be passed to the RouteToLabel node after being modified.) |
|
RouteToLabel | Basic | Mode | Route to First (This causes the RouteToLabel node to start processing the list of destinations from the first item, at the top of the list.) |
SinglePassenger | Basic | Label name | SinglePassenger (This is the name of the Label node to which the message flow passes the message. This name must match the label name set in the Decide On The Query node. See the ESQL in the Decide_on_query module below.) |
AllReservations | Basic | Label name | AllReservations (This is the name of the Label node to which the message flow passes the message. This name must match the label name set in the Decide On The Query node. See the ESQL in the Decide_on_query module below.) |
GetPassengerInformation | Basic | Data source | RESERVDB (This is the database used by this node.) |
Basic | ESQL module | GetPassengerInformation (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.) |
|
Basic | Compute mode | LocalEnvironment and Message (This causes the LocalEnvironment as well as the message to be passed to the XML_PASSENGERQUERY_OUT node after being modified.) |
|
GetReservationsInformation | Basic | Data source | RESERVDB (This is the database used by this node.) |
Basic | ESQL module | GetReservationsInformation (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.) |
|
Basic | Compute mode | LocalEnvironment and Message (This causes the LocalEnvironment as well as the message to be passed to the XML_PASSENGERQUERY_OUT node after being modified.) |
|
XML_PASSENGERQUERY_OUT | 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_PASSENGERQUERY_OUT (This is the local queue on which the message flow puts the message.) |
-- ************************************************ -- * ESQL for the XML_PassengerQuery message flow -- ************************************************ CREATE COMPUTE MODULE DecideOnQuery CREATE FUNCTION Main() RETURNS BOOLEAN BEGIN SET OutputRoot = InputRoot; IF InputRoot.XML.PassengerQuery.ReservationNumber <> '' THEN SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname = 'SinglePassenger'; ELSE SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname = 'AllReservations'; END IF; RETURN TRUE; END; END MODULE; CREATE COMPUTE MODULE GetPassengerInformation CREATE FUNCTION Main() RETURNS BOOLEAN BEGIN SET OutputRoot = InputRoot; SET OutputRoot.XML.PassengerQuery = NULL; -- populate the environment with passenger info from the database SET Environment.Variables = THE (SELECT T.* FROM Database.XMLPASSENGERTB AS T WHERE T.RESERVATIONNO = InputRoot.XML.PassengerQuery.ReservationNumber); -- populate the output message with info from the database query CREATE FIELD OutputRoot.XML.PassengerInfoResponse.PassengerInfo; DECLARE outpass REFERENCE TO OutputRoot.XML.PassengerInfoResponse.PassengerInfo; SET outpass.ReservationNumber = Environment.Variables.RESERVATIONNO; SET outpass.FirstName = Environment.Variables.FIRSTNAME; SET outpass.LastName = Environment.Variables.LASTNAME; SET outpass.FlightNumber = Environment.Variables.FLIGHTNO; SET outpass.Date = Environment.Variables.FLIGHTDATE; SET outpass.Class = Environment.Variables.CLASSTYPE; RETURN TRUE; END; END MODULE; CREATE COMPUTE MODULE GetReservationsInformation CREATE FUNCTION Main() RETURNS BOOLEAN BEGIN SET OutputRoot = InputRoot; SET OutputRoot.XML.PassengerQuery = NULL; -- populate the environment with reservations info from the database SET Environment.Variables.Reservation[] = (SELECT T.* FROM Database.XMLPASSENGERTB AS T WHERE T.FIRSTNAME = InputRoot.XML.PassengerQuery.FirstName AND T.LASTNAME = InputRoot.XML.PassengerQuery.LastName); -- populate the output message with info from the database query CREATE FIELD OutputRoot.XML.PassengerInfoResponse.ListOfReservations; DECLARE outres REFERENCE TO OutputRoot.XML.PassengerInfoResponse.ListOfReservations; DECLARE I INTEGER 1; DECLARE J INTEGER CARDINALITY(Environment.Variables.*[]); WHILE I <= J DO SET outres.Reservation[I].FlightNumber = Environment.Variables.Reservation[I].FLIGHTNO; SET outres.Reservation[I].Date = Environment.Variables.Reservation[I].FLIGHTDATE; SET outres.Reservation[I].Class = Environment.Variables.Reservation[I].CLASSTYPE; SET I = I + 1; END WHILE; RETURN TRUE; END; END MODULE;