About the Simplified Database Routing message flow

The Simplified Database Routing message flow retrieves employee details from a database if the details are not already in the contents of the input message. These employee details are retrieved based on the employee number provided in the input message. The message flow then routes a reply message based on more information retrieved based on an employee's manager. Based on the contents of the input message, different routing conditions are met. Messages might be output onto one or more of the following output queues depending on the routing conditions that have been met:

The following diagram shows the Simplified Database Routing message flow.

A screen capture of the Simplified Database Routing message flow

The following table lists the types of nodes that are used in the Simplified Database Routing message flow:

Node type Node name
MQInput MQInput
Route Route
DatabaseRetrieve

DatabaseRetrieve

DatabaseRoute DatabaseRoute
MQOutput FailureQ, KeyNotFoundQ, SeniorStaffQ, OrderClockQ, DefaultQ
Trace Trace

For more information, see Built-in nodes in the WebSphere Message Broker documentation.

The Simplified Database Routing message flow performs the following actions:

  1. The MQInput node gets the XML input message from the SIMPLERROUTEDB_IN queue. The message is passed to the Route node.
  2. The Route node checks the content of the input message to see whether the employee's work department field is available. If the field is available, the message is routed through the Match terminal to the DatabaseRoute node. If the field is not available, the employee details must be retrieved and the message is routed through the Default terminal to the DatabaseRetrieve node.
  3. The DatabaseRetrieve node queries the EMPLOYEE table in the database to retrieve the employee details. The employee number in the message is used as the key for the database lookup. The properties that are set in the DatabaseRetrieve node specify which values to retrieve from the database query on the EMPLOYEE table, and where to insert these values in the output message.
  4. If the employee number provides a match in the database, the message is populated with values from the database. The message is then passed to the DatabaseRoute node.
  5. If the employee number fails to match a value in the database, the original input message is passed through the keyNotFound terminal, to the KeyNotFoundQ node.
  6. The DatabaseRoute node performs a JOIN operation to compare the details of an employee and their manager. The JOIN operation has the following steps:
    1. The work department value from the input message is used in a database query to locate the department manager in the DEPARTMENT table.
    2. The manager number column value (DEPARTMENT.MGRNUM) is retrieved and used to link into the EMPLOYEE table to locate a specific employee record. Therefore, DEPARTMENT.MGRNUM links to EMPLOYEE.EMPNUM. The located employee record refers to the employment record for the manager of the employee.
    3. The values that are specified in the database query for the node are returned for the manager.
  7. The filter expressions in the DatabaseRoute node are then processed. The expressions are either true or false. The filter expressions are processed in the following way:
    1. If the employee work department value does not match a record in the DEPARTMENT table, the message is passed through the keyNotFound terminal to the KeyNotFoundQ node.
    2. If the age in years of the employee is greater than their manager and the manager's last name is 'KWAN', the DatabaseRoute node passes the input message through the OlderThanMe terminal to the SeniorStaffQ node. The next filter expression is then evaluated.
    3. If the employee's years in service from the input message is greater than 10, the DatabaseRoute node passes the input message through the TenYearsService terminal to the OrderClockQ node.
    4. If neither of the two filter expressions are true, the DatabaseRoute node passes the input message through the Default terminal to the DefaultQ node.
  8. If a processing failure occurs in any of the nodes, the input message is passed through the Failure terminal in the nodes to the Trace node for error processing.

The database nodes that are used in the Simplified Database Routing message flow sample read the information in the database, but do not make any updates to the data within the database.

Back to About the Simplified Database Routing sample