Creating the message flow

The Video message flow is supplied, but if you prefer you can create the message flow yourself.

Use the following instructions to create the Video message flow. There are detailed instructions for some of the following steps; to access them click the link provided at the end of the step.

  1. Switch to the Broker Application Development perspective.
  2. Create a new message flow message flow project called Video Message Flows. For instructions, see Creating a message flow project.
  3. Create a new message flow called Video_Test. 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.
    Node type Node name
    MQInput VIDEO_XML_IN
    MQInput VIDEO_TDS_IN
    MQInput VIDEO_CWF_IN
    MQOutput VIDEO_OUT
    MQOutput VIDEO_FAIL
    Compute Extract Fields
  5. 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 Video message flow.
    Node name Terminal Connect to this node
    VIDEO_XML_IN Failure VIDEO_FAIL
    Out Extract Fields
    Catch VIDEO_FAIL
    VIDEO_TDS_IN Failure VIDEO_FAIL
    Out Extract Fields
    Catch VIDEO_FAIL
    VIDEO_CWF_IN Failure VIDEO_FAIL
    Out Extract Fields
    Catch VIDEO_FAIL
    Extract Fields Out VIDEO_OUT
  6. 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.
    For the VIDEO_XML_IN, VIDEO_TDS_IN, and VIDEO_CWF_IN nodes, you have to set the message set identifier property. Every message set has a unique identifier. To find out what the identifier of the message set that you created is:
    1. In the Resource Navigator, expand the navigation tree: Video Messages > Video >messageSet.mset.
    2. Double-click messagetSet.mset to open it.
    3. Your unique message set identifier is displayed in the Message Set ID field.
    Node name Page Property Value
    VIDEO_XML_IN Basic Queue Name VIDEO_XML_IN
    Default Message Domain MRM
    Default Message Set (Select your unique message set identifier)
    Default Message Type Customer
    Default Message Format XML1
    VIDEO_TDS_IN Basic Queue Name VIDEO_TDS_IN
    Default Message Domain MRM
    Default Message Set (Select your unique message set identifier)
    Default Message Type Customer
    Default Message Format TDS1
    VIDEO_CWF_IN Basic Queue Name VIDEO_CWF_IN
    Default Message Domain MRM
    Default Message Set (Select your unique message set identifier)
    Default Message Type Customer
    Default Message Format CWF1
    VIDEO_FAIL Basic Queue Name VIDEO_FAIL
    Extract Fields Basic ESQL Module Video_Test_Compute
    VIDEO_OUT Basic Queue Name VIDEO_OUT
  7. Add the following ESQL code modules to the Video_Test.esql file. You can copy and paste the ESQL code directly into the esql file if you want.
    For instructions, see Developing ESQL.
    CREATE COMPUTE MODULE Video_Test_Compute
       CREATE FUNCTION Main() RETURNS BOOLEAN
       BEGIN
          -- This ESQL extracts some of the fields from the input message
          -- just to demonstrate the references used for fields in different
          -- namespaces
          
    	  SET OutputRoot = InputRoot;
          DECLARE addr NAMESPACE 'http://www.ibm.com/AddressDetails';
          DECLARE brw NAMESPACE 'http://www.ibm.com/BorrowedDetails';
          DECLARE I INTEGER;
    
    SET OutputRoot.MRM.Name = InputRoot.MRM.Name;
    SET OutputRoot.MRM.addr:Address = InputBody.addr:Address;
    
    IF InputRoot.MRM.ID ='P' THEN
    SET OutputRoot.MRM.PassportNo = InputBody.PassportNo;
    ELSEIF InputRoot.MRM.ID ='D' THEN SET OutputRoot.MRM.DrivingLicenseNo=InputBody.DrivingLicenseNo; ELSEIF InputRoot.MRM.ID ='C' THEN SET OutputRoot.MRM.CreditCardNo=InputBody.CreditCardNo;
    END IF; SET I=1; WHILE I<= CARDINALITY(InputBody.brw:Borrowed.*[]) DO SET OutputRoot.MRM.brw:Borrowed[I].VideoTitle = InputBody.brw:Borrowed[I].VideoTitle; SET OutputRoot.MRM.brw:Borrowed[I].DueDate=InputBody.brw:Borrowed[I].DueDate + INTERVAL '1' DAY; SET OutputRoot.MRM.brw:Borrowed[I].Cost=InputBody.brw:Borrowed[I].Cost*2; SET I=I+1; END WHILE; SET OutputRoot.MRM.Magazine = InputBody.Magazine; RETURN TRUE; END; END MODULE

Main Page icon   Back to sample home