Building the Managed File Transfer sample

If problems arise when you run the sample, see Preparing the environment for WebSphere MQ File Transfer Edition nodes or Resolving problems when running samples in the WebSphere Message Broker documentation.

Create the branch2HQDriver message flow

Use the following instructions to create the branch end of day sales application message flow.

  1. Create a new Message Broker project FTENodesSampleFlowProject. For more information, see Creating a Message Broker project in the WebSphere Message Broker documentation.
    1. Right-click the Message Broker project, click New > Message Flow.
    2. Set Message Flow Name to Branch2HQDriver.msgflow, click Finish.
  2. In the Message Flow editor, add and rename the nodes listed in the following table.
    Node type Node name
    MQInput Sales Data from Branch (MQ)
    Compute Prepare for FTEAgent
    FTEOutput File Transfer to HQ (FTE)
  3. Connect the nodes as described in the following table.
    Node name Terminal Connect to this node
    Sales Data from Branch (MQ) Out Prepare for FTEAgent
    Prepare for FTEAgent Out File Transfer to HQ (FTE)(IN)
  4. Customize the "Sales Data from Branch (MQ)" node:
    1. Right-click the "Sales Data from Branch (MQ)" node, click Properties.
    2. Click Basic, set Queue name to FTE_STOCK_REQ_BRANCH
    3. Click Input Message Parsing, set Message domain to BLOB.
    4. Click Advanced, select the Logical Order property.
  5. Customize the "Prepare for FTEAgent" node:
    1. Right-click the "Prepare for FTEAgent" node, click Properties.
    2. Click Basic, set ESQL Module to FTENodesSampleMFlow.Branch2HQDriver_PrepareforFTEAgent
    3. Set Compute Mode to LocalEnvironment and Message.
    4. Double-click the "Prepare for FTEAgent" node.
    5. Add the following ESQL statements in the BEGIN section:
      -- CALL CopyMessageHeaders();
      CALL CopyEntireMessage();
      	
      -- The BranchName(Code) to create the output file is taken from the MQMD Header		
      SET OutputLocalEnvironment.Wildcard.WildcardMatch = TRIM(InputRoot.MQMD.ApplOriginData);
      
  6. Customize the "File Transfer to HQ (FTE)" node:
    1. Right-click the "File Transfer to HQ (FTE)" node, click Properties.
    2. Click Basic, set Job name to a name of your choice, for example, Branch123
    3. Set Agent to an appropriate agent name that uses the following format, MB8BROKER.FTEHQ
    4. If you are using the default configuration, set Queue Manager to MB8QMGR
    5. Set Input directory to /ToHQ
    6. Set File name to StockReplenishmentRequest_*.xml
    7. Click Records and Elements, set Record Definition to Record is Whole File.

Create the FTEInputBranch2HQMFlow message flow

Use the following instructions to create the "HQ receiving stock replenishment details" message flow.

  1. Using the Message Broker project created previously, complete the following instructions:
    1. Right-click the Message Broker project, click New > Message Flow.
    2. Set Message Flow Name to FTEInputBranch2HQMFlow.msgflow, click Finish.
  2. In the Message Flow editor, add and rename the nodes listed in the following table:
    Node type Node name
    FTEInput Receive File from Branch (FTE)
    Compute Preserve Branch Details
    Compute Mark End of Branch Data
    Resequence Eliminate Duplication (Resequence)
    MQOutput Sent to HQ Replenishment App (MQ)
  3. Connect the nodes as described in the following table:
    Node name Terminal Connect to this node
    Receive File from Branch (FTE) Out Preserve Branch Details
    Preserve Branch Details Out Eliminate Duplication (Resequence)
    Receive File from Branch (FTE) End of Data Mark End of Branch Data
    Mark End of Branch Data Out Eliminate Duplication (Resequence)
    Eliminate Duplication (Resequence) Out Sent to HQ Replenishment App (MQ)
  4. Customize the "Receive File from Branch (FTE)" node:
    1. Right-click the "Receive File from Branch (FTE)" node, click Properties.
    2. Click Basic, set File name filter to StockReplenishmentRequest_*.xml
    3. Set Action on successful processing to Delete.
    4. Click Input Message Parsing, set Message domain to XMLNSC.
    5. Click Records and Elements, set Record detection to Parsed Record Sequence.
  5. Customize the "Preserve Branch Details" node:
    1. Right-click the "Preserve Branch Details" node, click Properties.
    2. Click Basic, set ESQL module to FTENodesSampleMFlow.FTEInputBranch2HQMFlow_PreserveBranchDetails
    3. Set Compute mode to LocalEnvironment and Message.
    4. Double-click the "Preserve Branch Details" node.
    5. Add the following ESQL statements in the BEGIN section:
      -- CALL CopyMessageHeaders();
      CALL CopyEntireMessage();
      
      SET OutputRoot.XMLNSC.StockReplenishment.SequenceNumber = InputLocalEnvironment.FTE.Record;
      
      -- Used by the resequence node to reject duplicate records in a recovery situation
      SET OutputLocalEnvironment.Wildcard.WildcardMatch = InputRoot.XMLNSC.StockReplenishment.BranchNumber;		
      SET OutputLocalEnvironment.StockReplenishment.SequenceNumber = InputLocalEnvironment.FTE.Record;
  6. Customize the "Mark End of Branch Data" node:
    1. Right-click the "Mark End of Branch Data" node, click Properties.
    2. Click Basic, set ESQL module to FTENodesSampleMFlow.FTEInputBranch2HQMFlow_MarkEndofBranchData
    3. Set Compute mode to LocalEnvironment and Message.
    4. Double-click the "Mark End of Branch Data" node.
    5. Add the following ESQL statements in the BEGIN section:
      -- CALL CopyMessageHeaders();
      CALL CopyEntireMessage();
      
      -- Take the Branch number from the File Name "StockReplenishmentRequest_*.xml"
      SET OutputRoot.XMLNSC.StockReplenishment.BranchNumber = SUBSTRING( InputLocalEnvironment.FTE.Name FROM 27 FOR 3 );
      SET OutputRoot.XMLNSC.StockReplenishment.SequenceNumber = InputLocalEnvironment.FTE.Record + 1;
      SET OutputRoot.XMLNSC.StockReplenishment.EndofData = 'true';
      
      -- For the Resequence Node
      SET OutputLocalEnvironment.Wildcard.WildcardMatch = OutputRoot.XMLNSC.StockReplenishment.BranchNumber;
      SET OutputLocalEnvironment.StockReplenishment.SequenceNumber = InputLocalEnvironment.FTE.Record + 1;
      SET OutputLocalEnvironment.StockReplenishment.EndofData = 'true';
  7. Customize the "Eliminate Duplication (Resequence)" node:
    1. Right-click the "Eliminate Duplication (Resequence)" node, click Properties.
    2. Click Basic, set Path to sequence number to $LocalEnvironment/StockReplenishment/SequenceNumber
    3. Set Path to sequence group identifier to $LocalEnvironment/Wildcard/WildcardMatch
    4. In End of sequence definition, set Predicate to $InputRoot/XMLNSC/StockReplenishment/EndofData="true"
  8. Customize the "Sent to HQ Replenishment App (MQ)" node:
    1. Right-click the "Sent to HQ Replenishment App (MQ)" node, click Properties.
    2. If you are using the default configuration, click Basic, set Queue manager name to MB8QMGR.
    3. Set Queue name to FTE_STOCK_PROCESS_HQ

Create the HQProcessingDriver message flow

Use the following instructions to create the "HQ stock provisioning application" message flow.

  1. Using the Message Broker project created previously, complete the following instructions:
    1. Right-click the Message Broker project, click New > Message Flow.
    2. Set Message Flow Name to HQProcessingDriver.msgflow, click Finish.
  2. In the Message Flow editor, add and rename the nodes listed in the following table:
    Node type Node name
    MQInput Receive Sales Data (MQ)
    Compute Demand Driven Replenishment
    MQOutput Send Stock Replenishment Invoice (MQ)
  3. Connect the nodes as described in the following table:
    Node name Terminal Connect to this node
    Receive Sales Data (MQ) Out Demand Driven Replenishment
    Demand Driven Replenishment Out Send Stock Replenishment Invoice (MQ)
  4. Customize the "Receive Sales Data (MQ)" node:
    1. Right-click the "Branch App Input" node, click Properties.
    2. Click Basic, set Queue name to FTE_STOCK_PROCESS_HQ
    3. Click Input Message Parsing, set Message domain to XMLNSC.
    4. Click Advanced, select the Logical Order property.
  5. Customize the "Demand Driven Replenishment" node:
    1. Right-click the "Demand Driven Replenishment" node, click Properties.
    2. Click Basic, set ESQL module to FTENodesSampleMFlow.HQProcessingDriver_DemandDrivenReplenishment
    3. Set Compute mode to LocalEnvironment and Message.
    4. Double-click the "Demand Driven Replenishment" node.
    5. Add the following ESQL statements in the BEGIN section:
      -- CALL CopyMessageHeaders();
      CALL CopyEntireMessage();
      -- SET OutputLocalEnvironment.Wildcard.WildcardMatch = InputRoot.XMLNSC.StockReplenishment.BranchNumber;
      
      -- Stock Replenishment changes is processed here
      IF ( InputRoot.XMLNSC.StockReplenishment.LineItem.ItemID = 'AA0533' ) THEN
      	SET OutputRoot.XMLNSC.StockReplenishment.LineItem.ActualSalesUnitPrice = '1.50';
      END IF;
      IF ( InputRoot.XMLNSC.StockReplenishment.LineItem.ItemID = 'AA0534' ) THEN
      	SET OutputRoot.XMLNSC.StockReplenishment.LineItem.Quantity = '163';
      	SET OutputRoot.XMLNSC.StockReplenishment.LineItem.Promotion = '4 for 2.00';
      END IF;
  6. Customize the "Send Stock Replenishment Invoice (MQ)" node:
    1. Right-click the "Send Stock Replenishment Invoice (MQ)" node, click Properties.
    2. If you are using the default configuration, click Basic, set Queue manager name to MB8QMGR.
    3. Set Queue name to FTE_STOCK_INVOICE_BRANCH

Create the FTEOutputHQ2BranchMFlow message flow

Use the following instructions to create the "Branch outlets receive stock replenishment XML file from HQ" message flow.

  1. Using the Message Broker project created previously, complete the following instructions:
    1. Right-click the Message Broker project, click New > Message Flow.
    2. Set Message Flow Name to FTEOutputHQ2BranchMFlow.msgflow, click Finish.
  2. In the Message Flow editor, add and rename the nodes listed in the following table.
    Node type Node name
    MQInput Receive Stock Replenishment Invoice (MQ)
    Compute Prepare for FTEAgent
    FTEOutput Transfer to Branch (FTE)
  3. Connect the nodes as described in the following table.
    Node name Terminal Connect to this node
    Receive Stock Replenishment Invoice (MQ) Out Prepare for FTEAgent
    Prepare for FTEAgent Out Transfer to Branch (FTE)(In)
    Prepare for FTEAgent Out1 Transfer to Branch (FTE)(Finish File)
  4. Customize the "Receive Stock Replenishment Invoice (MQ)" node:
    1. Right-click the "Receive Stock Replenishment Invoice (MQ)" node, click Properties.
    2. Click Basic, set Queue name to FTE_STOCK_INVOICE_BRANCH
    3. Click Input Message Parsing, set Message domain to XMLNSC.
    4. Click Advanced, select the Logical Order property.
  5. Customize the "Prepare for FTEAgent" node:
    1. Right-click the "Prepare for FTEAgent" node, click Properties.
    2. Click Basic, set ESQL module to FTENodesSampleMFlow.FTEOutputHQ2BranchMFlow_PrepareforFTEAgent
    3. Set Compute mode to LocalEnvironment and Message.
    4. Double-click the "Prepare for FTEAgent" node.
    5. Add the following ESQL statements in the BEGIN section:
      -- CALL CopyMessageHeaders();
      CALL CopyEntireMessage();
      		
      SET OutputLocalEnvironment.Wildcard.WildcardMatch = InputRoot.XMLNSC.StockReplenishment.BranchNumber;
      IF ( InputRoot.XMLNSC.StockReplenishment.EndofData = 'true' ) THEN
      	PROPAGATE TO TERMINAL 'out1';
      	RETURN FALSE;
      END IF;
      RETURN TRUE;
  6. Customize the "Transfer to Branch (FTE)" node:
    1. Right-click the "Transfer to Branch (FTE)" node, click Properties.
    2. Click Basic, set Job name to a name of your choice, for example, Invoice to FTEBRANCH123
    3. Set Agent to an appropriate agent name that uses the following format, MB8BROKER.FTEBRANCH123
    4. If you are using the default configuration, set Queue manager to MB8QMGR.
    5. Click Basic, set Input directory to /ToBranch
    6. Set File name to StockReplenishmentInvoice_*.xml
    7. Click Records and Elements, set Record Definition to Record is Unmodified Data.

Create the broker properties

To run the sample you must create the following local queues:

Create the following broker archive (BAR) files and add the specified message flows:

For more information on creating a broker archive, see Creating a Broker archive.

Create the following execution groups and deploy the specified BAR file:

See Creating an execution group and Deploying a broker archive file.

Back to sample home