Getting Started with Processes (Policy Manager 8.x)
Learn about common and operation-specific processes, process management tools, and use cases.
Supported Platforms: 8.0x, 8.2x, 8.4x
Table of Contents
- Process Contexts
- Process Function Reference
- Policy Manager Scripting API
- Process Management Tools
- Example: Adding a Script Activity to an operation
The Akana API Platform and Akana Policy Manager allow you to define web service orchestration concepts using an XML-based graphical editor called the Process Palette. Here, you can:
- Define the sequence of messages as they flow through for each virtual service operation.
- Configure a variety of different Activities for achieving the results required for each operation.
Let's take a quick walkthrough of the process types and tools available, to get you started.
There are several approaches to configuring process definitions:
- You can configure a set of common processes for an organization, using the Add Process function. Common processes are available for all resources within the organization.
- You can define a process for a specific operation:
- In Policy Manager, choose Services > Operations > Process or Services > Operations > Fault.
- In the developer portal, go to the API Implementation page.
Referencing a Process
If you define processes at the organization level, you can reference/re-use them at the operation level. This approach is most efficient for processes that might be used multiple times, and can help make your process development cycle more efficient.
The example below shows referencing a process using a Process Activity in the Process Editor.
Referencing a Script
In the same way that you can reuse a process by referencing it, you can also reuse a script.
You can define a series of utility scripts for performing common tasks. To do this:
- Add a script:
- In Policy Manager: Scripts folder
- In the developer portal: Organization > Scripts
- In your virtual service operation process definition:
- Add a Script Activity.
- Import a pre-defined script.
- Add a script reference for the function you want to perform.
For example, you might have a requirement to validate some data as part of your process. In this example, you might create a reusable script that includes a function for validating data (validateData), and call the script TestScript. Then, in your process definition, you can import TestScript and reference the function in the script source.
This example is shown below.
Process Function Reference
The Process Function Reference includes a tour of the Process Editor and descriptions and usage examples for each Activity type. To ensure a smooth process when building your process definitions, familiarize yourself with the functionality, techniques, and rules for using each Activity. For more information, refer to Process Reference for Policy Manager 8.x.
Policy Manager Scripting API
The Policy Manager Scripting API provides a series of interfaces and classes that you can use to build process-related scripts. You can access this API in the following locations:
- In Policy Manager: Documentation files in the docs\scriptDocs folder of the Akana Platform Folder.
- On the Akana Documentation Repository, choose the applicable version: Policy Manager Scripting API.
Process Management Tools
For an overview of all the tools in the Process Palette, and functions that apply to the common process definitions, see Managing Processes.
Example: Adding a Script Activity to an operation
The procedure below walks you through adding a Script activity to a specific operation using the Process Editor. When you've added the script, you can run the operation in Test Client and you will see a new header in the Response/Headers tab.
Example: to add a specific script activity to an operation
- Open the Process Editor for a specific operation.
- Drag and drop the Script Activity icon to the grid.
- Change the arrows so that the order of activity is Receive > Invoke Activity > Script Activity > Reply:
- Drag the end arrow from Reply Activity to Script Activity. This directs the Script Activity to execute directly after the Invoke Activity.
- Click the center of the Script Activity and drag and drop (draw) a new arrow to the center of the Reply Activity. This directs the Reply Activity to execute after the Script Activity.
- Specify values for the Script Activity:
- Double-click any activity to go to the Activity Edit page.
- In the Script text box, type or paste the following script:
var msg = processContext.getVariable("message"); var headers = msg.getTransportHeaders(); headers.add("myHeaderName", "myHeaderValue"); msg.setTransportHeaders(headers);
- Click the Save icon (on the palette) to save the data.
- Click Cancel to exit the Process Editor and return to the Implementation page.
For additional information on using script activity variables, refer to the Process Editor reference documentation for the Script activity.
Now that you've familiarized yourself with the high-level approach of building processes, and know what reference materials and tools are available, you can start building your processes.