Calling a Sub-Process Flow From a Service Object

How to:

The iWay Designer Process object facilitates modularity and code reuse by inserting a published process flow (called a sub-process flow in this best practice) into the current process flow. Special validation and processing take place when you publish a main process flow that calls a sub-process flow through the standard Process object. The result is an implementation in which the sub-process flow is coupled to the main process flow. The sub-process flow is deployed when the main process flow is deployed.

Instead of calling the sub-process flow through a Process object, you can call the sub-process flow through an iWay Designer Service object of class XDPFlowAgent. If you call the sub-process flow through a Service object, you force the publish and deployment logic to postpone linkage to the sub-process flow. The sub-process flow becomes dynamic, and it is called by name.

With this construction, the sub-process flow works even when it is called through a defined Special Register (SREG), or other iWay Functional Language (iFL) expression. Inspection of a generated main process flow that has this construction reveals that the main process flow does not contain the code for the sub-process flow.


Top of page

x
Procedure: How to Call a Sub-Process Flow From a Service Object

This procedure assumes that:

  1. Using iWay Designer, move all critical processing that may change from the main process flow to a sub-process flow.
  2. To use the sub-process flow in the main process flow, publish the sub-process flow to the Registry, using the iWay Designer Build/Publish menu option. If you modify the sub-process flow after you have published it, make sure to publish the modified version.
  3. In the main process flow, add a Service object, assign a name to it, and optionally supply a description. You will use the Service object instead of the Process object to call the sub-process flow from the main process flow.
  4. In the Service Type dialog box, click the Class Name radio button, and type the following in the input field:
    XDPFlowAgent

    The following image shows the supplied Class Name.

  5. In the Define Service dialog box, indicate whether or not you want to make the new service globally available to other processes.
  6. Create a Special Register (SREG) that contains the name of the sub-process flow. Follow these steps to create a Special Register.
    1. In the New Service Object Properties dialog box, click the down arrow in the Value column next to the Name of the PFLOW column.
    2. Click Create variable.
    3. In the Property Manager dialog box, click the Run Time tab.
    4. In the Name column, select Click here to add.
    5. From the drop-down list in the Value column for the Special Register, click Add/Edit, as shown in the following image. In this example, the name of the Special Register is SREG1.

    6. In the Add / Edit dialog box, type the name of the sub-process flow, and click OK.
    7. In the Property Manager dialog box, confirm that the value for the Special Register is correct, as shown in the following image. Then click OK.

    8. In the New Service Object Properties dialog box, from the drop-down list in the Value column next to the Name of the PFLOW column, click the name of the Special Register.

      In the following image, the name of the Special Register (SREG1) that contains the name of the sub-process flow is supplied.

      Important: Do not use a literal name for the sub-process flow. If you do, the iWay Designer Build/Test/Run function will fail.

    9. In the New Service Object Properties dialog box, click Finish.
  7. Using the iWay Designer Build/Test/Run menu option, test the main process flow against a configuration, for example, base. Tip: You cannot test the main process flow against the Registry.
  8. Deploy the sub-process flow through the iWay Service Manager Administration Console, using the console Deployments/Services option.

    In the following image, a sub-process flow named XMLtoXML_PF has been deployed.

    If you omit this step, you will get a run-time error.

  9. Modify, save, publish, and deploy the sub-process flow as needed. You can repeatedly undeploy an older version of the sub-process flow and deploy an updated version, without error. All callers of the sub-process flow (for example, the Web service) dynamically inherit the latest version of the sub-process flow.

    Tip: In the Service Management pane of the iWay Service Manager Administration Console, you can click the Visualize service icon in the View column for the sub-process flow to display the last deployed version of the sub-process flow. If an older version of the sub-process flow is displayed in the Process Flow Visualization window in the console, click View and Refresh.


iWay Software