Creating the main message flow

The Error Handler sample main message flow is supplied, but if you prefer to create the message flow yourself, follow the instructions below:

  1. In the Message Brokers Toolkit, switch to the Broker Application Development perspective.
  2. Create a new message flow called Main_Flow in the message flow project called Error Handler Message Flows, which you created when you created the subflow.
  3. For instructions, see Creating a message flow.
  4. In the Message Flow editor, add and rename the nodes listed in the following table.
    For instructions, see Adding a node.
    Palette drawers Node type Node name
    WebSphere MQ MQInput STAFF_IN
    WebSphere MQ MQOutput STAFF_FAIL
    Routing Filter Check Valid Staff Number
    Database Database Update Staff Database
    Construction Throw Throw Exception
    WebSphere MQ MQOutput STAFF_OUT
  5. Add the subflow to the main message flow:
    1. Ensure that the Main_Flow.msgflow file is displayed in the Message Flow editor.
    2. Right-click the Message Flow editor, then click Add Subflow... The Add Subflow dialog opens.
    3. In the Add Subflow dialog, expand the Error Handler Message Flows project, expand (default), then click Error_Handler.msgflow, which is the subflow file. Click OK.
    4. A node called Error_Handler, representing the subflow, is added to the Message Flow editor.
  6. Connect the nodes together as listed in the following table.
    For instructions, see Connecting nodes.
    To check that you have connected the nodes together correctly, see the figure in About the Error Handler sample.
    Node name Terminal Connect to this node
    STAFF_IN Out Error_Handler
    Failure STAFF_FAIL
    Error Handler Out Check Valid Staff Number
    Check Valid Staff Number False Throw Exception
    True Update Staff Database
    Update Staff Database Out STAFF_OUT
  7. Configure the node properties as listed in the following table. Accept the default values for all properties unless an alternative value is listed in the table.
    For instructions, see Configuring a node.
    Node name Page Property Value
    STAFF_IN Basic Queue name STAFF_IN
    Input Message Parsing Message domain XML : For XML messages
    STAFF_FAIL Basic Queue name STAFF_FAIL
    Advanced Transaction mode Yes
    Update Staff Database Basic Data source STAFFDB
    Throw Exception Basic Message number 3001
    Basic Message text Invalid staff number
    STAFF_OUT Basic Queue name STAFF_OUT
    Advanced Transaction mode Yes
  8. In the Error Handler Message Flows project, double-click the Main_Flow.esql file to open it in the ESQL editor. Copy and paste the following ESQL code modules to the ESQL file, then save the file. For more information, see Developing ESQL.
    CREATE FILTER MODULE Main_Flow_Filter
       CREATE FUNCTION Main() RETURNS BOOLEAN
          BEGIN
       If Body.Staff.StaffNumber<='10' THEN
          RETURN TRUE;
          ELSE
          RETURN FALSE;
       END IF;
       END;
    END MODULE;
    
    CREATE DATABASE MODULE Main_Flow_Database
       CREATE FUNCTION Main() RETURNS BOOLEAN
       BEGIN
       INSERT INTO Database.STAFF(STAFFNUM, LASTCHANGE, FIRSTNAME, LASTNAME)
       VALUES(Body.Staff.StaffNumber, CURRENT_TIMESTAMP, 
       Body.Staff.NameInfo.FirstName, Body.Staff.NameInfo.LastName); 
       RETURN TRUE;
       END;
    END MODULE;
  9. Save the message flow.

Main Page icon   Back to Building the Error Handler sample.