Calling a Sub-Process Flow From a Service Object
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.
x
Procedure: How to Call a Sub-Process Flow From a Service Object
This
procedure assumes that:
- You have already
created a main process flow. If you have not, use iWay Designer
to do so.
- You are familiar
with the features of iWay Designer and know how to use that tool.
For details on iWay Designer, see the iWay Designer User's
Guide.
- You are familiar
with the features of the iWay Service Manager Administration Console
and know how to use the console. For details on the console, see
the iWay Service Manager User's Guide.
-
Using iWay
Designer, move all critical processing that may change from the
main process flow to a sub-process flow.
-
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.
-
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.
-
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.
-
In the Define
Service dialog box, indicate whether or not you want to make the
new service globally available to other processes.
-
Create a
Special Register (SREG) that contains the name of the sub-process flow.
Follow these steps to create a Special Register.
-
In the New Service Object Properties dialog box, click the
down arrow in the Value column next to the Name of the PFLOW column.
-
Click Create variable.
-
In the Property Manager dialog box, click the Run Time tab.
-
In the Name column, select Click here to add.
-
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.
-
In the Add / Edit dialog box, type the name of the sub-process flow,
and click OK.
-
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.
-
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.
-
In the New Service Object Properties dialog box, click Finish.
-
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.
-
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.
-
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.