- Basic Architecture
- Policy Lifecycle and Mechanics
- Policy Limits and Queuing
- Policy Queuing
- Policy Spillover
- Policy Failover
- Deployment Models
- Security Models
- Summary
Policy Lifecycle and Mechanics
The lifecycle of a policy begins with creating that policy in the OIS Client. For more information on how to create a policy, refer to Chapter 5, "Policy Basics." As the policy is created, edited, or tested (within the Policy Testing Console), the policy data is stored locally by the OIS Client. The policy data remains in local storage until the policy is Checked In by the policy author.
Check In
After the Check In button is pressed, the OIS Client contacts the Management Service so the policy can be written to the datastore. In this scenario, the Management Service acts as a proxy or broker so the OIS Client machines do not access the datastore directly—as doing so would mean every author would require write access to the various database tables.
The OIS Client transmits the policy in the form of object data and configuration data for those objects (based on the installed Foundation objects and the objects contained within any Integration Packs [IPs] deployed to the client). This policy data, which is loosely formatted eXtended Markup Language (XML) data, is taken by the Management Service and written into the datastore. The creation or update of a policy is a somewhat complex process and involves several tables. As an example, a new policy can easily create one or more new records in each of the following tables within the datastore:
- POLICIES
- OBJECTS
- (General object tables relating to each type of object used)
- LINKS
- FOLDERS
- SCHEDULES
- VARIABLES
- COUNTERS
Dormant Policy
After the Management Service writes the policy to the datastore, nothing else happens as part of the transaction. The policy is now located within the datastore and visible to other OIS Clients should they look for it, but in terms of execution, the policy is now dormant. The policy has not yet been marked for execution and remains dormant until an OIS Client, Opalis Operator Console (OOC), Command Line executable, or Web Service invocation changes this state.
Starting the Policy
To start a policy that is checked in, someone typically uses the OIS Client and presses the Start button or presses the Start button within the OOC (or through one of the other programmatic start options). Regardless of how the request is initiated, the result is the datastore is updated such that the policy is now marked to start. This happens by updating the record for the policy within several policy related tables via the PublishPolicy stored procedure (the affected tables are POLICY_PUBLISH_QUEUE, POLICY_REQUEST_ ACTION_SERVERS, POLICY REQUEST HISTORY, and POLICIES). The first two tables establish which Action Server the policy will run on (if more than one Action Server exists). The final update in the stored procedure alters the Published and Publishing Time columns in the Policies table. This updates the Published column from False to True and adds the current time to the Publishing Time column. (The term Published used by the datastore in this context is now archaic. In early versions of OIS 5.x, the Start button was labeled Publish, and because the database structure has not been fundamentally altered since then, the term Published remains.)
Action Servers and Policy Instantiation
Action Servers are designed to regularly update the datastore to report their heartbeat (every 15 seconds) and check if any new policies need to be executed (every 2 seconds). If there are no policies for the Action Server to run, it closes the connection and will retry in several seconds. However, if the Action Server finds a policy it can run, it gathers all the details about the policies from the related tables and then uses that information to instantiate an executable in memory. The name of the executable is always PolicyModule.exe (or PolicyModule.exe*32 on Windows 2008 systems as the PolicyModule.exe is a 32-bit application).
PolicyModule.exe
The Action Server instantiates one PolicyModule.exe for every submitted request to execute a policy. If a policy does not start with a Monitor object and a Start request is issued more than once, multiple instances of that policy can potentially run concurrently. This means if a given Action Server is running 17 policies, as viewed from the Operator Console, there will be 17 instances of PolicyModule.exe in memory at that time. Both active and idle (or monitoring) policies are in memory as PolicyModule.exe. As policies start, the Process ID (PID) of the policy is recorded to the datastore and is viewable from clients. In this way, a client can use the PID reported through logging to determine which instance of PolicyModule.exe belongs to a given policy.
There are two types of policies:
- Ad hoc
- Monitored
The mechanism is identical to check-in and start either type of policy, although the two behave differently when they execute. These policies are discussed in the following sections.
Policy Behavior (Ad hoc)
An ad hoc policy is any policy that does not begin with a monitor object. Ad hoc policies will load into memory as PolicyModule.exe and execute each object within the policy in turn until the policy runs out of objects along its given execution path. After the policy reaches its conclusion, the PolicyModule.exe exits and the policy terminates. An ad hoc policy does not reinstantiate until someone starts the policy again. However, if the policy is not permitted to finish normally (meaning it ends prematurely while there are still more objects along its given execution path)—perhaps caused by a server abend—the Action Server will not report the policy as completed to the datastore. As long as the policy is not reported as completed, the policy runs again (either by the same Action Server or by another if the first has failed or run out of capacity). This behavior is what most users expect when a policy fails.
A policy runs until it is complete; if interrupted before finishing, it will start again. Every policy starts with the first object, regardless of whether it failed previously. It is possible to design a policy to check to see if it previously ended prematurely, reload the relevant data, and start again; however, this is not the default policy behavior. For more information on building restartable policies, see Chapter 7.
Policy Behavior (Monitor)
A monitored policy is any policy that begins with a monitor object. (These policies can only contain one monitor object.) Monitored policies are sometimes referred to as long running policies. A monitored policy begins like an ad hoc policy, started by a user or external trigger; but because the first object in the policy is a monitor, the conditions of that monitor will dictate when the rest of the policy will trigger.
As an example, if the first object in a monitored policy is a File Monitor configured to wait for a file named datalog.xls to appear in C:\Drop, the policy loads and begins monitoring the C:\Drop folder for datalog.xls. Until that file appears, the remaining objects in the workflow will not run. This policy might stay in memory indefinitely waiting on the desired condition to occur.
After the desired condition occurs, two things take place:
- As soon as the monitor condition for the first object is satisfied, a new PolicyModule.exe instantiates to replace the monitoring activity.
- The policy executes just as an ad hoc job would, following all the objects along its given execution path.
By instantiating a new PolicyModule.exe as soon as the monitor condition is satisfied, the monitoring is constant and uninterrupted. If you are familiar with how a Transmission Control Protocol (TCP) port listener behaves, you can use this as an analogous behavior. As soon as the socket on port 3389 is filled by an incoming Remote Desktop Protocol (RDP) connection, a new socket on the same port is created. Monitored polices behave in a similar fashion.
After a monitored policy is running, it will not stop on its own. The user or an external trigger will have to stop the policy.
In both situations (monitored and ad hoc), the desired outcome of the policy is not the relevant measure. Regardless of whether the desired outcome is success or failure as long as the policy executes all of objects in its path, the Action Server reports the policy as successfully completed. In terms of policy management by the datastore and the Action Servers, this completion is the only one that matters.