JBoss.orgCommunity Documentation

Runtime Governance: User Guide


1. Overview
2. Installation
2.1. Setup Target Environment
2.1.1. JBoss EAP
2.1.2. Fuse
2.2. Further Configuration
2.2.1. Database
2.3. Test the installation using the samples
2.3.1. JBoss EAP
2.3.2. Fuse
2.4. JBoss EAP Specific Information
2.4.1. SQL Database
2.4.2. Caching
3. Visualising the Runtime Governance Information
3.1. Accessing the Runtime Governance UI
3.2. Services
3.3. Situations
3.3.1. Situation Lifecycle
3.4. Analytics
3.4.1. Dashboard
3.4.2. Changing the Time Frame and Refresh Cycle
3.4.3. Filtering by selection
3.4.4. Segmenting information by query
3.4.5. Adhoc queries
3.4.6. Customizing and sharing the Dashboard
4. Reporting Activity Information
4.1. Integrated Activity Collector
4.1.1. Supported Environments
4.1.2. Information Processor
4.1.3. Activity Validation
4.2. Reporting and Querying Activity Events via REST
4.2.1. Reporting Activity Information
4.2.2. Querying Activity Events using an Expression
4.2.3. Retrieving an Activity Unit
4.2.4. Retrieve Activity Events associated with a Context Value
5. Analyzing Events
5.1. Configuring an Event Processor Network
5.1.1. Defining the Network
5.1.2. Registering the Network
5.1.3. Supporting Multiple Versions
5.2. Event Processors
5.2.1. Drools Event Processor
5.2.2. JPA Event Processor
5.2.3. Mail Event Processor
5.2.4. MVEL Event Processor
5.2.5. Supporting Services
5.3. Predicates
5.3.1. MVEL Predicate
6. Accessing Derived Information
6.1. Configuring Active Collections
6.1.1. Defining the Source
6.1.2. Registering the Source
6.2. Presenting Results from an Event Processor Network
6.3. Publishing Active Collection Contents as JMX Notifications
6.4. Querying Active Collections via REST
6.5. Pre-Defined Active Collections
6.5.1. ServiceResponseTimes
6.5.2. Situations
6.5.3. ServiceDefinitions
6.5.4. Principals
7. Available Services
7.1. Call Trace
7.2. Report Server
7.2.1. Creating and deploying a report definition
7.2.2. Generating an instance of the report
7.2.3. Providing a custom Business Calendar
7.3. Service Dependency
7.3.1. How to customize the severity levels
7.4. Situation Manager
7.4.1. Ignoring situations related to a subject
7.4.2. Observing situations related to a subject
8. Managing The Infrastructure
8.1. Managing the Activity Collector
8.1.1. Activity Collector
8.1.2. Activity Logger
8.2. Managing the Event Processor Networks
8.2.1. Event Processor Network Manager
8.2.2. Event Processor Networks
8.3. Managing the Active Collections
8.3.1. Active Collection Manager
8.3.2. Active Collections

This section provides an overview of the Runtime Governance architecture.

The architecture is separated into four distinct areas, with components that bridge between these areas:

  • Activity Collector - this component is optional, and can be embedded within an executing environment to manage the collection of information
  • Activity Server - this component provides a store and query API for activity information. If not using the Activity Collector, then activity information can be reported directly to the server via a suitable binding (e.g. REST).
  • Event Processor Network - this component can be used to analyse the activity information. Each network can be configured with a set of event processing nodes, to filter, transform and analyse the events, to produce relevant rules.
  • Active Collection - this component is responsible for maintaining an active representation of information being collected. UI components can then access this information via REST services to present the information to users (e.g. via gadgets)

This document will explain how a user can configure these components to work together to build a Runtime Governance solution to realtime monitoring of executing business transactions.

This section will describe how to install Overlord Runtime Governance in different environments.

  • Download the JBoss EAP distribution (version 6.1 and 6.3 are currently supported), and unpack it in a suitable location.
  • Download Apache Ant and follow the installation instructions.
  • If using rtgov with switchyard, then download SwitchYard (version 2.0.0.Final or higher) and install it into the JBoss EAP environment. We recommend using the switchyard installer, which can be unpacked in a temporary location, and run ant in the root folder to be prompted for the location of the JBoss EAP environment.

Note

If switchyard is not installed, then you won’t be able to use the quickstarts, which are based around providing runtime governance for a switchyard application.

  • Download the latest release of RTGov from the Overlord website, then unpack the distribution into a suitable location.
  • The final step is to perform the installation of Overlord Runtime Governance using ant. To do the installation, use the following command from the root folder of the installation:
ant [ -Dpath=<root-folder> ] [ -Dtype=<installation-type> ]

If the <root-folder> is not explicitly provided on the command line, then the user will be prompted for the information.

The <installation-type> value can be:

ValueDescription

all

This will result in the full server configuration being installed into the server, including activity collector (for obtaining activities generated within that server), activity server (for receiving activity information whether from a remote client or internal activity collector), event processor network (to analyse the events), active collections (to maintain result information) and a collection of REST services to support remote access to the information. This is the default value.

client

This will result in only the activity collector functionality being installed, using a RESTful client to communicate with a remote Runtime Governance server.

To uninstall, simply perform the following command in the root folder of the installation:

ant uninstall [ -Dpath=<root-folder> ] [ -Dtype=<installation-type> ]

To start the server, go to the EAP bin folder and run:

./standalone.sh -c standalone-full.xml

Note

Due to some issues with the fuse 6.1 distribution, it is necessary to patch the environment. Download the zip file attached to the article https://developer.jboss.org/wiki/RTGovDeploymentOnFuse61WithAndWithoutFabric and unpack it over the fuse environment.

  • Configure JBoss Nexus

Add the JBoss public maven repository to the file etc/org.ops4j.pax.url.mvn.cfg, by appending the following URL to the org.ops4j.pax.url.mvn.repositories property:

    https://repository.jboss.org/nexus/content/groups/public@id=jboss.public
  • Start the fuse console, using the bin/fuse command, and then enter the following commands:
features:addurl mvn:org.overlord.rtgov/overlord-rtgov-features-fuse6/<version>/xml/features
features:install rtgov-karaf-commands

Note

<version> in the first command should be replaced by the RTGov version that you wish to use, e.g. 2.0.0.Final.

If wanting to install the all profile (representing the RTGov server and co-located activity collector), then run:

overlord:rtgov:all:configure <password>
features:install rtgov-all

where <password> is the overlord administration password for this rtgov environment.

However, if just wanting to install the client profile (co-located activity collector), then run:

overlord:rtgov:client:configure <username> <password>
features:install rtgov-client

where <username> and <password> are the credentials of the rtgov server environment that this client environment will report activity information to. The <password> is also used to configure the local overlord keystore used to hold the remote rtgov server’s credentials.

If using SwitchYard, then also run:

features:install rtgov-switchyard

This registers the event listener on SwitchYard, to capture activity and report it to RTGov.

The configuration properties for the Runtime Governance capability are common across all platforms. However their location varies:

ValueDescription

jboss-eap-6

The properties are found in the standalone*.xml files in the <root>/standalone/configuration folder, or domain.xml file in <root>/domain/configuration folder. The properties are defined under a configuration element with an attribute "name=overlord-rtgov".

fuse-6.1

The properties are found in the <root>/etc/overlord-rtgov.properties file.

Although there will be some properties that are independent of the installation type, some will be specific and therefore are listed in separate sections below.

Common

The common properties available across all installation types are:

PropertyDescription

collectionEnabled

This property will determine whether activity information is collected when the server is initially started. This value can be changed at runtime using the ActivityCollector MBean (see the chapter on Managing the Infrastructure).

ActivityServerLogger.activityListQueueSize

This property defines the queue size for pending activity lists, that are awaiting being reported to the Activity Server.

ActivityServerLogger.durationBetweenFailureReports

To avoid logs being overlorded with failure reports, failures will only be reported once within the defined time interval (in milliseconds).

ActivityServerLogger.freeActivityListQueueSize

This property defines the queue size to manage free activity lists that can be reused.

ActivityServerLogger.maxThreads

This property is an integer that represents the maximum number of threads that should be used to report activity events to the server (whether remote or embedded).

BatchedActivityUnitLogger.maxTimeInterval

The maximum wait interval (in milliseconds) before sending any held activity units to the Activity Server.

BatchedActivityUnitLogger.maxUnitCount

The maximum number of activity units that should be held before sending as a batch to the Activity Server.

All Type

PropertyDescription

ActiveCollectionManager.houseKeepingInterval

Time interval (in milliseconds) between house keeping tasks being invoked.

ActivityStore.class

The class associated with the Activity Store implementation to be used.

Elasticsearch.server

URL to the Elasticsearch server (HTTP port).

infinispan.container

The infinispan container to use.

MVELSeverityAnalyzer.scriptLocation

Optional location of a MVEL script used to determine severity levels for nodes and links within the service overview diagram.

SituationStore.class

The class associated with the Situation Store implementation to be used.

Note

Activity and Situation Store implementation specific properties will be discussed in the database section below.

Client Type

This installation type is used to configure an execution environment that will be sending its activity information to a remote Runtime Governance server using REST. The relevant properties are:

PropertyDescription

RESTActivityServer.serverURL

This is the URL of the activity server collecting the activity events.

RESTActivityServer.serverUsername

The username used to access the REST service.

RESTActivityServer.serverPassword

The password used to access the REST service.

This section described the configuration of the supported database options.

Note

This is the default "out of the box" configuration.

To use Elasticsearch as the Activity and Situation Store implementation, the following property values need to be defined:

ActivityStore.class=org.overlord.rtgov.activity.store.elasticsearch.ElasticsearchActivityStore
SituationStore.class=org.overlord.rtgov.analytics.situation.store.elasticsearch.ElasticsearchSituationStore

with the additional support properties:

PropertyDescription

Elasticsearch.hosts

Either has value "embedded" (the default), or a list of <host>:<port> values representing nodes in the Elasticsearch cluster, the port representing the TCP transport connection.

Elasticsearch.schedule

When using batched mode, the interval (in milliseconds) between updates being sent to the Elasticsearch server.

Elasticsearch.ActivityStore.responseSize

Maximum size for the response (default value 100000).

Elasticsearch.ActivityStore.timeout

"Best effort" timeout value (milliseconds) (default value 10000ms).

Elasticsearch.SituationStore.responseSize

Maximum size for the response (default value 100000).

Elasticsearch.SituationStore.timeout

"Best effort" timeout value (milliseconds) (default value 10000ms).

The following information describes the Elasticsearch clustering options that are supported with RTGov. For more information please see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-node.html

Out of the box, RTGov starts up with an in-VM Elasticsearch node for convenience. Such a setup is not recommended for a production environment for the following reasons:

  • Elasticsearch running on the same JVM could result in resource contention, e.g. memory or cpu, which could impact the application performance
  • In a clustered or load-balanced environment we would require Elasticsearch to persist the data to the same cluster

RTGov does not attempt to wrap or hide the standard Elasticsearch configurations. If you know how to tweak and tune an Elasticsearch node then these configuration changes can be applied to the appropriate location (dependent upon platform):

ValueDescription

jboss-eap-6

The properties are found in the standalone*.xml files in the <root>/standalone/configuration folder, or domain.xml file in <root>/domain/configuration folder. The properties are defined under a configuration element with an attribute "name=overlord-rtgov-elasticsearch".

fuse-6.1

The properties are found in the <root>/etc/overlord-rtgov-elasticsearch.properties file.

If you want to learn how to configure and tune Elasticsearch then please reference the Elasticsearch documentation at http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/setup-configuration.html

Some of those configuration properties that may need to be changed include:

  • cluster.name: Cluster name identifies your cluster for auto-discovery. If you’re running multiple clusters on the same network, make sure you’re using unique names
  • node.name: Node names are generated dynamically on startup, so you’re relieved from configuring them manually. However you can tie a node to a specific name
  • path.data: Path to directory where to store index data allocated for this node

There are 3 ways Elasticsearch cluster communication can be configured within RTGov:

Local Elasticsearch embedded server

node.local=true

This configuration does not communicate outside of the VM, only performing discovery of Elasticsearch nodes started on the same same VM.

Client only with no local data

When you start an Elasticsearch client, the most important decision is whether it should hold data or not. In other words, should indices and shards be allocated to it. Many times we would like to have the clients just be clients, without shards being allocated to them. This is simple to configure by setting either:

node.data=false

and/or

node.client=true

With this configuration, the client is cluster aware and can route its data to the responsible shards avoiding a double hop.

Clustered client with local data

This is the default "out of the box" configuration for RTGov. This starts a simple Elasticsearch node that can hold data and also join other Elasticsearch nodes in a cluster.

node.data=true
node.client=false
node.local=true

When RTGov has been installed, try out the samples to get an understanding of its capabilities, and check that your environment has been correctly installed/configured.

To install the samples into JBoss EAP go to the samples folder in the distribution. You will need to install Apache Maven to be able to use the examples.

The key examples are explained below. Each quickstart also has a readme providing the instructions for use.

To try out the samples in Fuse, you will need to start up the Fuse console.

To install an OSGi application to provide a simple order management capabilty, with an Event Processor Network to convert exceptions into Situations, run the following command from the fuse console:

features:install rtgov-samples-ordermgmt-epn

Send some requests to the order management service, at the URL http://localhost:8181/cxf/orderservice/orders/submit, with basic authentication username=admin, password=admin (as defined in the etc/user.properties file). For example, send the message:

{"orderId":"1","itemId":"BUTTER","quantity":100,"customer":"Fred"}

which should return the result:

{
    "total": 125,
    "accepted": true,
    "customer": "Fred",
    "orderId": "1",
    "status": "Order Accepted"
}

If you then send:

{"orderId":"6","itemId":"ERROR","quantity":100,"customer":"Fred"}

you will get the response:

Failed with an error

and a Situation will be created in the RTGov UI.

To install a policy that will check for SLA violations, run the following command from the fuse console:

features:install rtgov-samples-sla

Send some requests to the order management service, at the URL http://localhost:8181/cxf/orderservice/orders/submit, with basic authentication username=admin, password=admin (as defined in the etc/user.properties file). For example, send the message:

{"orderId":"3","itemId":"JAM","quantity":100,"customer":"Fred"}

which should return the result after a slight delay:

{
    "total": 240,
    "accepted": true,
    "customer": "Fred",
    "orderId": "3",
    "status": "Order Accepted"
}

The delay is caused by the request for itemId JAM, and results in the policy detecting a SLA violation which are reported as two Situation events that can be viewed in the RTGov UI.

To install a policy that will be evaluated immediately, to prevent a customer from invoking a service more than once within two seconds, run the following comand from the fuse console:

features:install rtgov-samples-policy-sync

Send the following request twice in quick succession, to the order management service at the URL http://localhost:8181/cxf/orderservice/orders/submit, with basic authentication username=admin, password=admin (as defined in the etc/user.properties file):

{"orderId":"1","itemId":"BUTTER","quantity":100,"customer":"Fred"}

The first request will return the expected:

{
    "total": 125,
    "accepted": true,
    "customer": "Fred",
    "orderId": "1",
    "status": "Order Accepted"
}

However the second invocation (if performed within two seconds of the first) will return:

Customer 'Fred' cannot perform more than one request every 2 seconds

To install a policy that will evaluate a customer’s debt level, and suspend their account if it becomes too high, run the following comand from the fuse console:

features:install rtgov-samples-policy-async

Send some requests to the order management service, at the URL http://localhost:8181/cxf/orderservice/orders/submit, with basic authentication username=admin, password=admin (as defined in the etc/user.properties file). For example, send the message:

{"orderId":"1","itemId":"BUTTER","quantity":100,"customer":"Fred"}

When the credit limit has been reached, the customer will be suspended, resulting in a response "Customer Fred has been suspended".

If we then sent the following request, to the URL http://localhost:8181/cxf/orderservice/orders/pay, to clear some of customer Fred’s debt:

{"amount":400,"customer":"Fred"}

we will then be able to send further order requests.

The database is defined by the datasource configuration located here: $JBOSS_HOME/standalone/deployment/overlord-rtgov/rtgov-ds.xml as part of the server installation type.

The default SQL database is the H2 file based database, and is created during the installation of the all type.

Note

The following sections discuss changes to the standalone-full.xml configuration file. If using a clustered environment, then these changes should be applied to the standalone-full-ha.xml instead.

MySQL

  • Create the folder $JBossAS/modules/mysql/main.
  • Put the MySQL driver jar in the $JBossAS/modules/mysql/main folder, e.g. mysql-connector-java-5.1.12.jar.
  • Create a module.xml file, within the $JBossAS/modules/mysql/main folder, with the contents:
<module xmlns="urn:jboss:module:1.1" name="mysql">
   <resources>
     <resource-root path="mysql-connector-java-5.1.12.jar"/>
   </resources>
   <dependencies>
     <module name="javax.api"/>
     <module name="javax.transaction.api"/>
   </dependencies>
</module>
  • Edit the $JBossAS/standalone/configuration/standalone-full.xml file to include the MySQL driver:

<subsystem xmlns="urn:jboss:domain:datasources:1.0">
        <datasources>
            .....
            <drivers>
                ...
                <driver name="mysql" module="mysql">
                    <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                </driver>
            </drivers>
        </datasources>
    </subsystem>
  • Update the rtgov datasource file, $JBossAS/standalone/deployments/overlord-rtgov/rtgov-ds.xml, the contents should be:

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
    <datasource jndi-name="java:jboss/datasource/OverlordRTGov" pool-name="OverlordRTGov" enabled="true" use-java-context="true">
        <connection-url>jdbc:mysql://localhost:3306/rtgov</connection-url>
        <driver>mysql</driver>
        <security>
            <user-name>root</user-name>
            <password></password>
        </security>
    </datasource>
</datasources>

Postgres

  • Create the $JBossAS/modules/org/postgresql/main folder.
  • Put the postgresql driver jar in the $JBossAS/modules/org/postgresql/main folder, e.g. postgresql-9.1-902.jdbc4.jar.
  • Create a module.xml file, within the $JBossAS/modules/org/postgresql/main folder, with the contents:
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
   <resources>
     <resource-root path="postgresql-9.1-902.jdbc4.jar"/>
   </resources>
   <dependencies>
     <module name="javax.api"/>
     <module name="javax.transaction.api"/>
   </dependencies>
</module>
  • Edit the $JBossAS/standalone/configuration/standalone-full.xml file to include the PostgresSQL driver:

<subsystem xmlns="urn:jboss:domain:datasources:1.0">
        <datasources>
            .....
            <drivers>
                ...
                <driver name="postgresql" module="org.postgresql">
                    <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
                </driver>
            </drivers>
        </datasources>
    </subsystem>
  • Update the rtgov datasource file, $JBossAS/standalone/deployments/overlord-rtgov/rtgov-ds.xml, the contents should be:

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
        <datasource jndi-name="java:jboss/datasource/OverlordRTGov" pool-name="OverlordRTGov" enabled="true" use-java-context="true">
        <connection-url>jdbc:postgresql://localhost:5432/rtgov</connection-url>
        <driver>postgresql</driver>
        <security>
            <user-name>....</user-name>
            <password>....</password>
        </security>
    </datasource>
</datasources>

This section describes how to use the Runtime Governance User Interface (UI).

This section shows the Situations that are reported when RTGov policies detect issues that need to be bought to the attention of users.


The left hand panel provides a variety of options for filtering the list of situations.

The list contains the following columns:

  • Severity - an icon to indicate how severe the situation is.
  • Type - identifies the nature of the situation (e.g. SLA Violation, Exception, etc).
  • Status - where the situation is in its lifeycycle (see further down for description of the lifecycle).
  • Subject - the subject of the situation, which will generally be a service type and operation, with optional fault name.
  • Timestamp - when it occurred.
  • Description - further details about the situation.
  • Action - show properties for the situation.

At the bottom left is a collapsed region containing controls for performing bulk actions.


These actions can operate either on the filtered situations (as shown here), or all situations. The actions themselves, from left to right, are retry (i.e. resubmit an associated message to the target service), export and remove.

When a new Situation occurs, if the user is already viewing the situations page, then a small notification will be displayed in the top right corner:


If this notification is expanded, it will list some of the details for the new Situations:


The user can either select one of the entries to navigate to it’s details, or alternatively use the refresh button to update the list.

To view the details associated with a Situation in the list, select its type field, which will navigate to the details page:


This page shows the details of the situation, including properties and context data.

The Call Trace tab shows the call stack associated with the business transaction, if appropriate context information has been recorded with the situation.


Selecting a node in the call trace displays further details in the right hand panel.

The optional Message tab is displayed if the Situation has an associated business message.


If the service and operation, associated with the situation, supports resubmission of the messages (i.e. if a SwitchYard service, then it would need to have an SCA binding and the operation would need to be one-way), then the user will be able to edit the message content and press the Resubmit button. This will result in resubmission information being displayed:


RTGov uses Elasticsearch to store the activity information, and Kibana to provide a dashboard for analysing that information.

The "out of the box" dashboard layout presents the following information:



The Kibana dashboard enables a user to filter the information being viewed by:

  • pressing the magnifying glass symbol associated with some information of interest (see action in the image below)

  • pressing the no entry sign symbol associated with the information to be excluded (see action in the image above)
  • selecting the information of interest from a pie chart (e.g. selecting a fault, as shown in the image below)

As well as being able to focus/exclude information based on the other graphs, the Documents table provides even more fine grained control over what is displayed. In the following image it shows how the fault value of itemnotfound could be used as a filter, instead of selecting it from the pie chart. However, more importantly adhoc fields such as customer or productName could be equally used as the subject of the filter, if that information is recorded with the activity events (and therefore the response time data).


As each filter is added, to progressively refine the results being viewed, their details are listed in the "FILTERING" section at the top of the dashboard, as shown in the following image:


The first box identifies the initial time range used to display the data, which has been refined by the next box based on interactively selecting a region on the response time graph. The third box applies a filter to only show information related to the InventoryService service type, and finally the fourth box narrows the information further to show the subset of response time information associated with the itemnotfound fault.

Any of the these filter criteria can individually be disabled (using the tick symbol) or cancelled (using the cross symbol).

Although filtering provides a useful way to narrow in on information of interest to view that data in the available graphs. It is sometimes more interesting to be able to compare different sets of results.

In the default dashboard all response time information is treated in the same way, and therefore not differentiated. If we want to segment the information based on various groupings, then we need to create what are called pinned queries. At the top of the dashboard, you will need to expand the blue "QUERY" region to find a data entry area. This can be used to enter adhoc queries to filter the results displayed in the dashboard (see following section).

However for the purpose of comparing different sets of data, we leave the default entry blank and instead create one or more additional query fields, but pressing the plus symbol present in the last entry field.

When an entry field has been created, enter an appropriate query. For example,

  • serviceType: "{urn:switchyard-quickstart-demo-orders:0.1.0}OrderService/InventoryService"

This query will identify response times associated with the InventoryService service type.

  • properties.customer: "Fred"

If the customer name has been associated with the reported activity events, then this query will identify the response time information associated with a particular customer.

As shown in the following image, the colour coded segmented queries are reflected in the response time graph:


as well as the Distribution over time chart:


To change the label associated with a query, select the query coloured dot and enter the label in the field, followed by pressing the close button:


It is also possible to temporarily disable a particular query, or change its colour, using this popup dialog.

There are two ways in which activity information can be collected for further processing by the Runtime Governance server.

  1. Integrating an activity collector into the execution environment. This will intercept activities and automatically report them to the Runtime Governance server.
  2. Manually report the activity information to the Runtime Governance server through a publicly available API (e.g. REST service)

This section will explain how to use both approaches.

This section will discuss how an integrated activity collector can be used to automatically collect, pre-process and optionally validate activity events before finally reporting them to the server.

This section discusses the environments that currently support integrated activity collectors.

To collect activity events from an OSGi application, a proxy can be used to intercept inbound and outbound invocations on a service, and report the activity to an embedded activity collector within the OSGi container. These proxies can be wired into an OSGi application using blueprint, e.g.

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

    <service interface="org.overlord.rtgov.quickstarts.demos.ordermgmt.orderservice.OrderService"
    						ref="orderServiceProxy" />

    <bean id="orderServiceProxy" class="org.overlord.rtgov.client.ActivityProxyHelper"
    			factory-method="createServiceProxy" >
    	<argument value="org.overlord.rtgov.quickstarts.demos.ordermgmt.orderservice.OrderService" />
    	<argument ref="orderServiceBean" />
   	</bean>

    <bean id="orderServiceBean" class="org.overlord.rtgov.quickstarts.demos.ordermgmt.orderservice.OrderServiceBean" >
       	<property name="inventoryService" ref="inventoryServiceProxy"/>
       	<property name="logisticsService" ref="logisticsServiceProxy"/>
    </bean>

    <bean id="inventoryServiceProxy" class="org.overlord.rtgov.client.ActivityProxyHelper"
    			factory-method="createClientProxy" >
    	<argument value="org.overlord.rtgov.quickstarts.demos.ordermgmt.inventoryservice.InventoryService" />
    	<argument ref="orderServiceBean" />
    	<argument ref="inventoryServiceBean" />
   	</bean>

    <bean id="logisticsServiceProxy" class="org.overlord.rtgov.client.ActivityProxyHelper"
    			factory-method="createClientProxy" >
    	<argument value="org.overlord.rtgov.quickstarts.demos.ordermgmt.logisticsservice.LogisticsService" />
    	<argument ref="orderServiceBean" />
    	<argument ref="logisticsServiceBean" />
   	</bean>

    <reference id="inventoryServiceBean"
               interface="org.overlord.rtgov.quickstarts.demos.ordermgmt.inventoryservice.InventoryService">
    </reference>

    <reference id="logisticsServiceBean"
               interface="org.overlord.rtgov.quickstarts.demos.ordermgmt.logisticsservice.LogisticsService">
    </reference>

</blueprint>

The service interface is associated with a bean representing the service proxy, created using the createServiceProxy static factory method on the class org.overlord.rtgov.client.ActivityProxyHelper.

Similarly, the outbound relationships from the service to other OSGi components are established via a client proxy, using the createClientProxy static factory method on the org.overlord.rtgov.client.ActivityProxyHelper class.

To enable the Runtime Governance infrastructure, and the user policies/rules that are defined within it, to make the most effective use of the activities that are reported, it is necessary to pre-process certain events to extract relevant information for use in:

  • correlating activity events to a particular business transaction instance
  • highlighting important properties that may need to be used in business policies

Extracting the property information is important for various reasons:

  • it enables the business policies to remain independent of the specific information format used, and thus more efficiently access the key details (i.e. as properties)
  • it is important to control what information is distributed within the actvity events, for both size (i.e. performance) and security/privacy reasons.

By default, information content should not be distributed unless an information processor has been defined to explicitly indicate how that information should be represented (if at all) within the activity event.

This section explains how information processors can be configured and deployed along side the business applications they are monitoring.

The Information Processor can be defined as an object model or specified as a JSON representation for packaging in a suitable form, and subsequently de-serialized when deployed to the governed execution environment.

The following is an example of the JSON representation of a list of Information Processors. This particular example accompanies the Order Management sample:

[{
	"name":"OrderManagementIP",
	"version":"1",
	"typeProcessors":{
		"{urn:switchyard-quickstart-demo:orders:1.0}submitOrder":{
			"contexts":[{
				"type":"Conversation",
				"evaluator":{
					"type":"xpath",
					"expression":"order/orderId"
				}
			}],
			"properties":[{
				"name":"customer",
				"evaluator":{
					"type":"xpath",
					"expression":"order/customer"
				}
			},{
				"name":"item",
				"evaluator":{
					"type":"xpath",
					"expression":"order/itemId"
				}
			}]
		},
		"{urn:switchyard-quickstart-demo:orders:1.0}submitOrderResponse":{
			"contexts":[{
				"type":"Conversation",
				"evaluator":{
					"type":"xpath",
					"expression":"orderAck/orderId"
				}
			}],
			"properties":[{
				"name":"customer",
				"evaluator":{
					"type":"xpath",
					"expression":"orderAck/customer"
				}
			},{
				"name":"total",
				"evaluator":{
					"type":"xpath",
					"expression":"orderAck/total"
				}
			}]
		},
		"java:org.switchyard.quickstarts.demos.orders.Order":{
			"contexts":[{
				"type":"Conversation",
				"evaluator":{
					"type":"mvel",
					"expression":"orderId"
				}
			}],
			"properties":[{
				"name":"customer",
				"evaluator":{
					"type":"mvel",
					"expression":"customer"
				}
			},{
				"name":"itemId",
				"evaluator":{
					"type":"mvel",
					"expression":"itemId"
				}
			}]
		},
		"java:org.switchyard.quickstarts.demos.orders.OrderAck":{
			"contexts":[{
				"type":"Conversation",
				"evaluator":{
					"type":"mvel",
					"expression":"orderId"
				}
			}],
			"properties":[{
				"name":"customer",
				"evaluator":{
					"type":"mvel",
					"expression":"customer"
				}
			},{
				"name":"total",
				"evaluator":{
					"type":"mvel",
					"expression":"total"
				}
			}]
		},
		"{urn:switchyard-quickstart-demo:orders:1.0}makePayment":{
			"properties":[{
				"name":"customer",
				"evaluator":{
					"type":"xpath",
					"expression":"payment/customer"
				}
			},{
				"name":"amount",
				"evaluator":{
					"type":"xpath",
					"expression":"payment/amount"
				}
			}]
		},
		"{urn:switchyard-quickstart-demo:orders:1.0}makePaymentResponse":{
			"properties":[{
				"name":"customer",
				"evaluator":{
					"type":"xpath",
					"expression":"receipt/customer"
				}
			},{
				"name":"amount",
				"evaluator":{
					"type":"xpath",
					"expression":"receipt/amount"
				}
			}]
		},
		"java:org.switchyard.quickstarts.demos.orders.Receipt":{
			"properties":[{
				"name":"customer",
				"evaluator":{
					"type":"mvel",
					"expression":"customer"
				}
			},{
				"name":"amount",
				"evaluator":{
					"type":"mvel",
					"expression":"amount"
				}
			}]
		},
		"java:org.switchyard.quickstarts.demos.orders.ItemNotFoundException":{
			"script":{
				"type":"mvel",
				"expression":"activity.fault = \"ItemNotFound\""
			}
		}
	}
}]

This example illustrates the configuration of a single Information Processor with the top level elements:

FieldDescription

name

The name of the Information Processor.

version

The version of the Information Processor. If multiple versions of the same named Information Processor are installed, only the newest version will be used. Versions can be expressed using three schemes:

Numeric - i.e. simply define the version as a number

Dot Format - i.e. 1.5.1.Final

Any alpha, numeric and symbols.

typeProcessors

The map of type processors - one per type, with the type name being the map key.

When comparing versions, for example when determining whether a newly deployed Information Processor has a higher version than an existing one with the same name, then initially the versions will be compared as numeric values. If either are not numeric, then they will be compared using dot format, with each field being compared first as numeric values, and if not based on lexical comparison. If both fields don’t have a dot, then they will just be compared lexically.

Type Processor

The type processor element is associated with a particular information type (i.e. as its key). The fields associated with this component are:

FieldDescription

contexts

The list of context evaluators.

properties

The list of property evaluators.

script

An optional script evaluator that is used to do any other processing that may be required, such as setting additional properties in the activity event that are not necessarily derived from message content information.

transformer

An optional transformer that determines how this information type will be represented within an activity event.

Context Evaluator

The fields associated with the Context Evaluator component are:

FieldDescription

type

The context type, e.g. Conversation, Endpoint, Message or Link. These types are explained below.

timeframe

The number of milliseconds associated with a Link context type. If not specified, then the context is assumed to represent the destination of the link, so the source of the link must define the timeframe.

header

The optional header name. If not defined, then the expression will be applied to the information content to obtain the context value.

evaluator

The expression evaluator used to derived the context value. See further down for details.

The context types represent different ways in which the activity events can be related to each other or to a logical grouping (e.g. business transaction). Not all activity events need to be associated directly with a global business transaction id. They can be indirectly associated based on transitive correlation - e.g. activity 1 is associated with the global business transaction id, activity 2 is associated with activity 1 by a message context type, and activity 3 is associated with activity 2 based on an endpoint correlation id. All three activity events will be collectively correlated to the business transaction id.

An explanation of the different context types is,

Context TypeExplanation

Conversation

A conversation identifier can be used to correlate activity events to a business transaction associated with a globally unique identifer (e.g. an order id).

Endpoint

A globally unique identifier associated with one endpoint in a business transaction. For example, a process instance id associated with the business process executing within a service playing a particular role in the business transaction.

Message

The globally unique identify of a message being sent from one party to another.

Link

A temporal link between a source and destination activity. The temporal nature of the association is intended to enable non-globally unique details to be used to correlate activities, where the id is considered unique within the defined timeframe.

Property Evaluator

The fields associated with the Property Evaluator component are:

FieldDescription

name

The property name being initialized.

header

The optional header name. If not defined, then the expression will be applied to the information content to obtain the property value.

evaluator

The expression evaluator used to derive the property value. See further down for details.

Expression Evaluator

In the context and property evaluator components, they reference an expression evaluator that is used to derive their value. The expression evaluator has the following fields:

FieldDescription

type

The type of expression evaluator to use. Currently only support mvel or xpath.

expression

The expression to evaluate.

optional

Optional field that indicates whether the value being extracted by the expression is optional. The default is false. If a value is not optional, but the expression fails to locate a value, then an error will be reported

These expressions operate on the information being processed, to return a string value to be applied to the appropriate context or property.

Script

The script field of the Type Processor has the following fields:

FieldDescription

type

The type of script evaluator to use. Currently only support mvel.

expression

The expression to evaluate.

The MVEL script evaluator is supplied two variables for its use:

  • information - The information being processed
  • activity - The activity event

An example of how this script can be used is shown in the example above, associated with the ItemNotFoundException. In this case, the message on the wire does not carry the fault name, so the information processor is used to set the fault field on the activity event.

Transformer

The transformer field of the Type Processor has the following fields:

FieldDescription

type

The type of transformer to use. Currently support serialize and mvel.

The serialize transformer can take one optional additional boolean field includeHeaders (with default value false). This transformer simply attempts to convert the representation of the information into a textual form for inclusion in the activity event. So this transformer type can be used where the complete information content is required. If the optional includeHeaders field is specified as true, then any header values that accompany the message that are represented as either String or DOM, will be serialized in an internal property, which can then be used by tooling (e.g. the resubmission capability in the RTGov UI).

The mvel transformer takes the following additional fields:

The MVEL transformer script is supplied the following variable for its use:

FieldDescription

expression

The mvel expression to transform the supplied information.

The MVEL transformer is supplied the following variable for its use:

  • information - The information being processed

For example, to include the content of the submitOrder message:

	"typeProcessors":{
		"{urn:switchyard-quickstart-demo:orders:1.0}submitOrder":{
			....
			"transformer":{
				"type":"serialize"
			}
		},

JEE Container

The Information Processors are deployed within the JEE container as a WAR file with the following structure:

warfile
|
|-META-INF
|    |- beans.xml
|
|-WEB-INF
|    |-classes
|    |    |-ip.json
|    |    |-<custom classes/resources>
|    |
|    |-lib
|       |-ip-loader-jee.jar
|       |-<additional libraries>

The ip.json file contains the JSON representation of the Information Processor configuration.

The ip-loader-jee.jar acts as a bootstrapper to load and register the Information Processors.

If custom classes are defined, then the associated classes and resources can be defined in the WEB-INF/classes folder or within additional libraries located in the WEB-INF/lib folder.

A maven pom.xml that will create this structure is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  	<modelVersion>4.0.0</modelVersion>
	<groupId>....</groupId>
	<artifactId>....</artifactId>
	<version>....</version>
	<packaging>war</packaging>
	<name>....</name>

	<properties>
		<rtgov.version>....</rtgov.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.overlord.rtgov.activity-management</groupId>
			<artifactId>activity</artifactId>
			<version>${rtgov.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.overlord.rtgov.activity-management</groupId>
			<artifactId>ip-loader-jee</artifactId>
			<version>${rtgov.version}</version>
		</dependency>
		....
	</dependencies>

</project>

If deploying in JBoss Application Server, then the following fragment also needs to be included, to define the dependency on the core Overlord Runtime Governance modules:

.....
	<build>
		<finalName>....</finalName>
		<plugins>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<failOnMissingWebXml>false</failOnMissingWebXml>
 					<archive>
						<manifestEntries>
							<Dependencies>deployment.overlord-rtgov.war</Dependencies>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>
	.....

OSGi Container

The Information Processors are deployed within the OSGi container as a JAR file with the following structure:

jarfile
|
|-META-INF
|    |- MANIFEST.MF
|
|-ip.json
|-ip-loader-osgi.jar
|-<custom classes/resources>
|-<additional libraries>

The ip.json file contains the JSON representation of the Information Processor configuration.

The ip-loader-osgi.jar acts as a bootstrapper to load and register the Information Processors.

If custom classes are defined, then any associated classes, resources and additional libraries are located in the top level folder.

A maven pom.xml that will create this structure is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  	<modelVersion>4.0.0</modelVersion>
	<groupId>....</groupId>
	<artifactId>....</artifactId>
	<version>....</version>
	<packaging>war</packaging>
	<name>....</name>

	<properties>
		<rtgov.version>....</rtgov.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.overlord.rtgov.activity-management</groupId>
			<artifactId>activity</artifactId>
			<version>${rtgov.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.overlord.rtgov.activity-management</groupId>
			<artifactId>ip-loader-osgi</artifactId>
			<version>${rtgov.version}</version>
		</dependency>
		....
	</dependencies>

	<build>
		<finalName>....</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
 				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
						<Bundle-Version>${project.version}</Bundle-Version>
						<Bundle-Activator>org.overlord.rtgov.activity.processor.loader.osgi.IPActivator</Bundle-Activator>
						<Import-Package>
							!javax.inject.*,!javax.enterprise.*,!javax.persistence.*,
                            ....,
							*
						</Import-Package>
						<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
					</instructions>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

The Activity Validator mechanism provides the means to install event processing capabilities within the activity collection environment (i.e. co-located with the execution of the business transaction).

The main reason for performing analysis of the activity events at this stage in the runtime governance lifecycle is to enable the analysis to potential block the business transaction. For an example of such a case, please see the synchronous policy sample.

In some execution environments these validators can be implicitly called as part of collecting the activity events. However in some environments these validators need to be explicitly invoked, as they impact the execution behaviour. The SwitchYard environment is an example of this later environment, where an interceptor needs to be explicitly included within the SwitchYard application, which is responsible for invoking the validation capability and reacting to any issues it detects. To see how to configure such an interceptor, please see the synchronous policy sample.

The Activity Validator can be defined as an object model or specified as a JSON representation for packaging in a suitable form, and subsequently de-serialized when deployed to the governed execution environment.

The following is an example of the JSON representation of a list of Activity Validators. This particular example is from the synchronous policy sample:

[{
  "name" : "RestrictUsage",
  "version" : "1",
  "predicate" : {
    "@class" : "org.overlord.rtgov.ep.mvel.MVELPredicate",
    "expression" : "event instanceof org.overlord.rtgov.activity.model.soa.RequestReceived && event.serviceType == \"{urn:switchyard-quickstart-demo:orders:0.1.0}OrderService\""
  },
  "eventProcessor" : {
    "@class" : "org.overlord.rtgov.ep.mvel.MVELEventProcessor",
    "script" : "VerifyLastUsage.mvel",
    "services" : {
      "CacheManager" : {
        "@class" : "org.overlord.rtgov.common.infinispan.service.InfinispanCacheManager"
      }
    }
  }
}]

This example illustrates the configuration of a single Activity Validator with the top level elements:

FieldDescription

name

The name of the Activity Validator.

version

The version of the Activity Validator. If multiple versions of the same named Activity Validator are installed, only the newest version will be used. Versions can be expressed using three schemes:

Numeric - i.e. simply define the version as a number

Dot Format - i.e. 1.5.1.Final

Any alpha, numeric and symbols.

predicate

The optional implementation of the org.overlord.rtgov.ep.Predicate interface, used to determine if the activity event is relevant and therefore should be supplied to the event processor

eventProcessor

The implementation of the org.overlord.rtgov.ep.EventProcessor interface, that is used to analyse the activity event

When comparing versions, for example when determining whether a newly deployed Activity Validator has a higher version than an existing one with the same name, then initially the versions will be compared as numeric values. If either are not numeric, then they will be compared using dot format, with each field being compared first as numeric values, and if not based on lexical comparison. If both fields don’t have a dot, then they will just be compared lexically.

JEE Container

The Activity Validators are deployed within the JEE container as a WAR file with the following structure:

warfile
|
|-META-INF
|    |- beans.xml
|
|-WEB-INF
|    |-classes
|    |    |-av.json
|    |    |-<custom classes/resources>
|    |
|    |-lib
|       |-av-loader-jee.jar
|       |-<additional libraries>

The av.json file contains the JSON representation of the Activity Validator configuration.

The av-loader-jee.jar acts as a bootstrapper to load and register the Activity Validators.

If custom classes are defined, then the associated classes and resources can be defined in the WEB-INF/classes folder or within additional libraries located in the WEB-INF/lib folder.

A maven pom.xml that will create this structure is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  	<modelVersion>4.0.0</modelVersion>
	<groupId>....</groupId>
	<artifactId>....</artifactId>
	<version>....</version>
	<packaging>war</packaging>
	<name>....</name>

	<properties>
		<rtgov.version>....</rtgov.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.overlord.rtgov.activity-management</groupId>
			<artifactId>activity</artifactId>
			<version>${rtgov.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.overlord.rtgov.activity-management</groupId>
			<artifactId>av-loader-jee</artifactId>
			<version>${rtgov.version}</version>
		</dependency>
		....
	</dependencies>

</project>

If deploying in JBoss Application Server, then the following fragment also needs to be included, to define the dependency on the core Overlord Runtime Governance modules:

.....
	<build>
		<finalName>....</finalName>
		<plugins>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<failOnMissingWebXml>false</failOnMissingWebXml>
 					<archive>
						<manifestEntries>
							<Dependencies>deployment.overlord-rtgov.war</Dependencies>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>
	.....

OSGi Container

The Activity Validators are deployed within the OSGi container as a JAR file with the following structure:

jarfile
|
|-META-INF
|    |- MANIFEST.MF
|
|-av.json
|-av-loader-osgi.jar
|-<custom classes/resources>
|-<additional libraries>

The av.json file contains the JSON representation of the Activity Validator configuration.

The av-loader-osgi.jar acts as a bootstrapper to load and register the Activity Validators.

If custom classes are defined, then any associated classes, resources and additional libraries can be located in the top level folder.

A maven pom.xml that will create this structure is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  	<modelVersion>4.0.0</modelVersion>
	<groupId>....</groupId>
	<artifactId>....</artifactId>
	<version>....</version>
	<packaging>war</packaging>
	<name>....</name>

	<properties>
		<rtgov.version>....</rtgov.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.overlord.rtgov.activity-management</groupId>
			<artifactId>activity</artifactId>
			<version>${rtgov.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.overlord.rtgov.activity-management</groupId>
			<artifactId>av-loader-osgi</artifactId>
			<version>${rtgov.version}</version>
		</dependency>
		....
	</dependencies>

	<build>
		<finalName>....</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
 				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
						<Bundle-Version>${project.version}</Bundle-Version>
						<Bundle-Activator>org.overlord.rtgov.activity.validator.loader.osgi.AVActivator</Bundle-Activator>
						<Import-Package>
							!javax.inject.*,!javax.enterprise.*,!javax.persistence.*,
                            .....;
							*
						</Import-Package>
						<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
					</instructions>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>

This section explains how activity information can be reported to, and queried from, the Activity Server via a RESTful service.

An Event Processor Network is a mechanism for processing a stream of events through a network of linked nodes established to perform specific filtering, transformation and/or analysis tasks.

The network can be defined as an object model or specified as a JSON representation for packaging in a suitable form, and subsequently de-serialized when deployed to the runtime governance server.

The following is an example of the JSON representation of an Event Processor Network. This particular example defines the "out of the box" EPN installed with the distribution:

{
  "name" : "Overlord-RTGov-EPN",
  "version" : "1.0.0.Final",
  "subscriptions" : [ {
    "nodeName" : "SOAEvents",
    "subject" : "ActivityUnits"
  },
  {
    "nodeName" : "ServiceDefinitions",
    "subject" : "ActivityUnits"
  },
  {
    "nodeName" : "SituationsStore",
    "subject" : "Situations"
  } ],
  "nodes" : [
    {
      "name" : "SOAEvents",
      "sourceNodes" : [ ],
      "destinationSubjects" : [ "SOAEvents" ],
      "maxRetries" : 3,
      "retryInterval" : 0,
      "eventProcessor" : {
        "@class" : "org.overlord.rtgov.content.epn.SOAActivityTypeEventSplitter"
      },
      "predicate" : null,
      "notifications" : [ ]
    },{
      "name" : "ServiceDefinitions",
      "sourceNodes" : [ ],
      "destinationSubjects" : [ ],
      "maxRetries" : 3,
      "retryInterval" : 0,
      "eventProcessor" : {
        "@class" : "org.overlord.rtgov.content.epn.ServiceDefinitionProcessor"
      },
      "predicate" : null,
      "notifications" : [ {
      	"type" : "Results",
      	"subject" : "ServiceDefinitions"
      } ]
    },{
      "name" : "ServiceResponseTimes",
      "sourceNodes" : [ "ServiceDefinitions" ],
      "destinationSubjects" : [ "ServiceResponseTimes" ],
      "maxRetries" : 3,
      "retryInterval" : 0,
      "eventProcessor" : {
        "@class" : "org.overlord.rtgov.content.epn.ServiceResponseTimeProcessor"
      },
      "predicate" : null,
      "notifications" : [ {
      	"type" : "Results",
      	"subject" : "ServiceResponseTimes"
      } ]
    },{
      "name" : "SituationsStore",
      "maxRetries" : 3,
      "retryInterval" : 0,
      "eventProcessor" : {
        "@class" : "org.overlord.rtgov.ep.jpa.JPAEventProcessor",
        "entityManager" : "overlord-rtgov-epn-non-jta"
      }
    }
  ]
}

Another example of a network, used within one of the quickstarts is:

{
  "name" : "AssessCreditPolicyEPN",
  "version" : "${project.version}",
  "subscriptions" : [ {
    "nodeName" : "AssessCredit",
    "subject" : "SOAEvents"
  } ],
  "nodes" : [
    {
      "name" : "AssessCredit",
      "sourceNodes" : [ ],
      "destinationSubjects" : [ ],
      "maxRetries" : 3,
      "retryInterval" : 0,
      "predicate" : {
        "@class" : "org.overlord.rtgov.ep.mvel.MVELPredicate",
        "expression" : "event.serviceProvider && !event.request && event.serviceType == \"{urn:switchyard-quickstart-demo:orders:0.1.0}OrderService\""
      },
      "eventProcessor" : {
        "@class" : "org.overlord.rtgov.ep.mvel.MVELEventProcessor",
        "script" : "AssessCredit.mvel",
        "services" : {
          "CacheManager" : {
            "@class" : "org.overlord.rtgov.common.infinispan.service.InfinispanCacheManager"
          }
        },
        "parameters" : {
        	"creditLimit" : 150
        }
      }
    }
  ]
}

This example illustrates the configuration of a service associate with the event processor, as well as a predicate.

The top level elements of this descriptior are:

FieldDescription

name

The name of the network.

subscriptions

The list of subscriptions associated with the network, discussed below.

nodes

The nodes that form the connected graph within the network, discussed below.

version

The version of the network. Versions can be expressed using three schemes:

Numeric - i.e. simply define the version as a number

Dot Format - i.e. 1.5.1.Final Any alpha, numeric and symbols

When comparing versions, for example when determining whether a newly deployed EPN has a higher version than an existing network with the same name, then initially the versions will be compared as numeric values. If either are not numeric, then they will be compared using dot format, with each field being compared first as numeric values, and if not based on lexical comparison. If both fields don’t have a dot, then they will just be compared lexically.

This element is used to define a particular node in the graph that forms the network, and has the following fields:

FieldDescription

name

The name of the node.

sourceNodes

A list of node names that represent the source nodes, within the same network, that this node receives its events from. Therefore, if this list is empty, it means that the node is a root node and should be the target of a subscription.

destinationSubjects

A list of inter-EPN subjects to publish any resulting events to. Note: these subjects are only of relevance to other networks.

maxRetries

The maximum number of times an event should be retried, following a failure, before giving up on the event.

retryInterval

The delay that should occur between retry attempts - may only be supported in some environments.

eventProcessor

Defines the details for the event processor implementation being used. At a minimum, the value for this field should define a @class property to specify the Java class name for the event process implementation to use. Other general fields that can be configured are, the map of services and the map of parameters that can be used by the event processor. Depending upon which implementation is selected, the other fields within the value will apply to the event processor implementation.

predicate

This field is optional, but if specified will define a predicate implementation. As with the event processor, it must at a minimum define a @class field that specifies the Java class name for the implementation, with any additional fields be used to initialize the predicate implementation.

notifications

A list of notifications. A notification entry will define its type (explained below) and the notification subject upon which the information should be published. Unlike the destinationSubjects described above, which are subjects for inter-EPN communication, these notification subjects are the mechanism for distribution information out of the EPN capability, for presentation to end-users through various means.

Notify Types

The notify types field defines what type of notifications should be emitted from a node when processing an event. The notifications are the mechanism used by potentially interested applications to observe what information each node is processing, and the results they produce.

The possible values for this field are:

FieldDescription

Processed

This type indicates that a notification should be created when an event is considered suitable for processing by the node. An event is suitable either if no predicate is defined, or if the predicate indicates the event is valid.

Results

This type indicates that a notification should be created for any information produced as the result of the event processor processing the event.

Tip

Notifications are the mechanism for making information processed by the Event Processor Network accessible by interested parties. If a notity type(s) is not defined for a node, then it will only be used for internal processing, potentially supplying the processed event to other nodes in the network (or other networks if destination subject(s) are specified).

The Event Processor Network is deployed within the JEE container as a WAR file with the following structure:

warfile
|
|-META-INF
|    |- beans.xml
|
|-WEB-INF
|    |-classes
|    |    |-epn.json
|    |    |-<custom classes/resources>
|    |
|    |-lib
|       |-epn-loader-jee.jar
|       |-<additional libraries>

The epn.json file contains the JSON representation of the EPN configuration.

The epn-loader-jee.jar acts as a bootstrapper to load and register the Event Processor Network.

If custom predicates and/or event processors are defined, then the associated classes and resources can be defined in the WEB-INF/classes folder or within additional libraries located in the WEB-INF/lib folder.

A maven pom.xml that will create this structure is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  	<modelVersion>4.0.0</modelVersion>
	<groupId>....</groupId>
	<artifactId>....</artifactId>
	<version>....</version>
	<packaging>war</packaging>
	<name>....</name>

	<properties>
		<rtgov.version>....</rtgov.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.overlord.rtgov.event-processor-network</groupId>
			<artifactId>epn-core</artifactId>
			<version>${rtgov.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.overlord.rtgov.event-processor-network</groupId>
			<artifactId>epn-loader-jee</artifactId>
			<version>${rtgov.version}</version>
		</dependency>
		....
	</dependencies>

</project>

If deploying in JBoss Application Server, then the following fragment also needs to be included, to define the dependency on the core Overlord Runtime Governance modules:

.....
	<build>
		<finalName>slamonitor-epn</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<failOnMissingWebXml>false</failOnMissingWebXml>
 					<archive>
						<manifestEntries>
							<Dependencies>deployment.overlord-rtgov.war</Dependencies>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>
	.....

The Event Processor Network is deployed within the OSGi container as a JAR file with the following structure:

jarfile
|
|-META-INF
|    |- MANIFEST.MF
|
|-epn.json
|-epn-loader-osgi.jar
|-<custom classes/resources>
|-<additional libraries>

The MANIFEST.MF file is important, as it contains the OSGi metadata required for the container to understand the contents and imported packages.

The epn.json file contains the JSON representation of the EPN configuration.

The epn-loader-osgi.jar acts as a bootstrapper to load and register the Event Processor Network.

If custom predicates and/or event processors are defined, then the associated classes, resources and additional libraries can be located in the top level folder.

A maven pom.xml that will create this structure is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  	<modelVersion>4.0.0</modelVersion>
	<groupId>....</groupId>
	<artifactId>....</artifactId>
	<version>....</version>
	<packaging>war</packaging>
	<name>....</name>

	<properties>
		<rtgov.version>....</rtgov.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.overlord.rtgov.event-processor-network</groupId>
			<artifactId>epn-core</artifactId>
			<version>${rtgov.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.overlord.rtgov.event-processor-network</groupId>
			<artifactId>epn-loader-osgi</artifactId>
			<version>${rtgov.version}</version>
		</dependency>
		....
	</dependencies>

	<build>
		<finalName>....</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
 				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
						<Bundle-Version>${project.version}</Bundle-Version>
						<Bundle-Activator>org.overlord.rtgov.epn.loader.osgi.EPNActivator</Bundle-Activator>
						<Import-Package>
							!javax.inject.*,!javax.enterprise.*,!javax.persistence.*,
                            ....,
							*
						</Import-Package>
						<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
					</instructions>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

As previously mentioned, all EventProcessor implementations can define the following information:

FieldDescription

services

The optional map of names to services. The current service types are listed at the bottom of this section.

parameters

The optional map of names to parameters. These parameters can be used to customize the behaviour of an event processor.

Although custom event processors can be defined, there are some "out of the box" implementations. These are discussed in the following sub-sections.

The Drools Event Processor implementation (org.overlord.rtgov.ep.drools.DroolsEventProcessor) enables events to be processed by a Complex Event Processing (CEP) rule. This implementation defines the following additional fields:

FieldDescription

ruleName

The name of the rule, used to locate the rule definition in a file called "<ruleName>.drl".

An example of such a rule is:

import org.overlord.rtgov.activity.model.soa.RequestReceived
import org.overlord.rtgov.activity.model.soa.ResponseSent

global org.overlord.rtgov.ep.EPContext epc

declare RequestReceived
    @role( event )
    @timestamp( timestamp )
    @expires( 2m20s )
end

declare ResponseSent
    @role( event )
    @timestamp( timestamp )
    @expires( 2m20s )
end

rule "correlate request and response"
when
    $req : RequestReceived( $id : messageId ) from entry-point "Purchasing"
    $resp : ResponseSent( replyToId == $id, this after[0,2m20s] $req )  from entry-point "Purchasing"
then

    epc.logInfo("REQUEST: "+$req+" RESPONSE: "+$resp);

    java.util.Properties props=new java.util.Properties();
    props.put("requestId", $req.getMessageId());
    props.put("responseId", $resp.getMessageId());

    long responseTime=$resp.getTimestamp()-$req.getTimestamp();

    epc.logDebug("CORRELATION on id '"+$id+"' response time "+responseTime);

    props.put("responseTime", responseTime);

    epc.handle(props);

end

This is an example of a rule used to correlate request and response events. When a correlation is found, then a ResponseTime object is created and "forwarded" to the Event Processor Network for further processing using the handle method.

The source of the events into the rule are named entry points, where the name relates to the source node or subject that supplies the events.

The rule has access to external capabilities through the EPContext, which is defined in the statements:

global org.overlord.rtgov.ep.EPContext epc

This component is used at the end of the above example to handle the result of the event processing (i.e. to forward a derived event back into the network).

The rule can also access parameters using the getParameter(name) method on the context. See the javadoc for the org.overlord.rtgov.ep.EPContext interface for more information.

If an error occurs, that requires the event to be retried (within the Event Processor Network), or the business transaction blocked (when used as a synchronous policy), then the rule can either throw an exception or return the exception as the result using the handle() method.

Caution

Temporal rules do not currently work in a clustered environment. This is because correlation between events occurs in working memory, which is not shared across servers. Therefore for the correlation to work, all relevant events must be received by a single server.

An Active Collection is similar to a standard collection, but with the ability to report change notifications when items are inserted, updated or removed. The other main difference is that they cannot be directly updated - their contents is managed by an Active Collection Source which acts as an adapter between the collection and the originating source of the information.

This section will explain how to define an Active Collection Source and register it to indirectly create an Active Collection.

The source can be defined as an object model or specified as a JSON representation for packaging in a suitable form, and subsequently de-serialized when deployed to the runtime governance server.

The following is an example of the JSON representation that defines a list of Active Collection Sources - so more than one source can be specified with a single configuration:

[
  {
    "@class" : "org.overlord.rtgov.active.collection.epn.EPNActiveCollectionSource",
    "name" : "ServiceResponseTimes",
    "type" : "List",
    "itemExpiration" : 0,
    "maxItems" : 100,
    "subject" : "ServiceResponseTimes",
    "aggregationDuration" : 1000,
    "groupBy" : "serviceType + \":\" + operation + \":\" + fault",
    "aggregationScript" : "AggregateServiceResponseTime.mvel"
  },{
    "@class" : "org.overlord.rtgov.active.collection.epn.EPNActiveCollectionSource",
    "name" : "ServiceDefinitions",
    "type" : "Map",
    "itemExpiration" : 0,
    "maxItems" : 100,
    "subject" : "ServiceDefinitions",
    "scheduledScript" : "TidyServiceDefinitions.mvel",
    "scheduledInterval" : 60000,
    "properties" : {
        "maxSnapshots" : 5
    },
    "maintenanceScript" : "MaintainServiceDefinitions.mvel"
  },{
    "@class" : "org.overlord.rtgov.active.collection.epn.EPNActiveCollectionSource",
    "name" : "Situations",
    "type" : "List",
    "itemExpiration" : 40000,
    "maxItems" : 0,
    "subject" : "Situations",
    "activeChangeListeners" : [ {
        "@class" : "org.overlord.rtgov.active.collection.jmx.JMXNotifier",
    	"objectName" : "overlord.rtgov.services:name=Situations",
    	"descriptionScript" : "SituationDescription.mvel",
    	"insertTypeScript" : "SituationType.mvel"
	} ],
	"derived": [ {
		"name": "FilteredSituations",
		"predicate": {
			"type": "MVEL",
			"expression": "map = context.getMap(\"IgnoredSituationSubjects\"); if (map == null) { return false; } return !map.containsKey(subject);"
		},
	    "properties" : {
	        "active" : false
	    }
	} ]
  },{
    "@class" : "org.overlord.rtgov.active.collection.ActiveCollectionSource",
    "name" : "IgnoredSituationSubjects",
    "type" : "Map",
    "lazy" : true,
    "factory" : {
        "@class" : "org.overlord.rtgov.active.collection.infinispan.InfinispanActiveCollectionFactory",
        "cache" : "IgnoredSituationSubjects"
    }
  },{
    "@class" : "org.overlord.rtgov.active.collection.ActiveCollectionSource",
    "name" : "Principals",
    "type" : "Map",
    "lazy" : true,
    "visibility" : "Private",
    "factory" : {
        "@class" : "org.overlord.rtgov.active.collection.infinispan.InfinispanActiveCollectionFactory",
        "cache" : "Principals"
    }
  }
]

This configuration shows the definition of multiple Active Collection Sources. The top level elements for a source, that are common to all active collection sources, are:

FieldDescription

@class

This attribute defines the Java class implementing the Active Collection Source. This class must be directly or indirectly derived from org.overlord.rtgov.active.collection.ActiveCollectionSource.

name

The name of the Active Collection that will be created and associated with this source.

type

The type of active collection. The currently supported values (as defined in the org.overlord.rtgov.active.collection.ActiveCollectionType enum are:

List (default)

Map

visibility

The visibility of active collection, i.e. whether accessible via the remote access mechanisms such as REST. The currently supported values (as defined in the org.overlord.rtgov.active.collection.ActiveCollectionVisibility enum are:

Public (default)

Private

lazy

Whether active collection should be created on startup, or lazily instantiated upon first use. The default is false.

itemExpiration

If not zero, then defines the number of milliseconds until an item in the collection should expire (i.e. be removed).

maxItems

If not zero, defines the maximum number of items that the collection should hold. If an insertion causes the size of the collection to increase above this value, then the oldest item should be removed.

aggregationDuration

The duration (in milliseconds) over which the information will be aggregated.

groupBy

An expression defining the key to be used to categorize the information being aggregated. The expression can use properties associated with the information being aggregated.

aggregationScript

The MVEL script to be used to aggregate the information. An example will be shown in a following sub-section.

scheduledInterval

The interval (in milliseconds) between the invocation of the scheduled script.

scheduledScript

The MVEL script invoked at a fixed interval to perform routine tasks on the collection.

maintenanceScript

By default, events received by the active collection source will be inserted into the associated active collection. If a MVEL maintenance script is specified, then it will be invoked to manage the way in which the received information will be applied to the active collection.

properties

A set of properties that can be access by the various scripts.

derived

An optional list of definitions for derived collections that will be created with the top level active collection, and retained regardless of whether any users are currently accessing them. (Normally when a derived collection is created dynamically on demand, once it has served its purpose, it will be cleaned up). The definition will be explained below.

activeChangeListeners

The list of active change listeners that should be instantiated and automatically registered with the Active Collection. The listeners must be derived from the Java class org.overlord.rtgov.active.collection.AbstractActiveChangeListener.

factory

The optional factory for creating the active collection, derived from the class org.overlord.rtgov.active.collection.ActiveCollectionFactory.

The additional attributes associated with the EPNActiveCollectionSource implementation will be discussed in a later section.

Aggregation

The aggregation script is used to (as the name suggests) aggregate information being provided by the source, before being applied to the collection. The values available to the MVEL script are:

VariableDescription

events

The list of events to be aggregated.

The aggregated result will be returned from the script.

Scheduled

The scheduled script is used to perform regular tasks on the active collection, independent of any information being applied to the collection. The values available to the MVEL script are:

VariableDescription

acs

The active collection source.

acs.properties

The properties configured for the active collection source.

variables

A map associated with the active collection source that can be used by the scripts to cache information.

Maintenance

The maintenance script is used to manage how new information presented to the source is applied to the active collection. If no script is defined, then the information will be inserted by default. The values available to the MVEL script are:

VariableDescription

acs

The active collection source.

acs.properties

The properties configured for the active collection source.

key

The key for the information being inserted. May be null.

value

The value for the information being inserted.

variables

A map associated with the active collection source that can be used by the scripts to cache information.

An example script, showing how these variables can be used is:

int maxSnapshots=acs.properties.get("maxSnapshots");

snapshots = variables.get("snapshots");

if (snapshots == null) {
	snapshots = new java.util.ArrayList();
	variables.put("snapshots", snapshots);
}

// Update the current snapshot
currentSnapshot = variables.get("currentSnapshot");

if (currentSnapshot == null) {
	currentSnapshot = new java.util.HashMap();
}

snapshots.add(new java.util.HashMap(currentSnapshot));

currentSnapshot.clear();

// Remove any snapshots above the number configured
while (snapshots.size() > maxSnapshots) {
	snapshot = snapshots.remove(0);
}

// Merge snapshots
merged = org.overlord.rtgov.analytics.util.ServiceDefinitionUtil.mergeSnapshots(snapshots);

// Update existing, and remove definitions no longer relevant
foreach (entry : acs.activeCollection) {
	org.overlord.rtgov.analytics.service.ServiceDefinition sd=null;

	if (merged.containsKey(entry.key)) {
		acs.update(entry.key, merged.get(entry.key));
	} else {
		acs.remove(entry.key, entry.value);
	}

	merged.remove(entry.key);
}

// Add new definitions
for (key : merged.keySet()) {
	acs.insert(key, merged.get(key));
}

This example shows the script accessing the Active Collection Source and its properties, as well as accessing (and updating) the variables cache associated with the source.

The Active Collection Source is deployed within the JEE container as a WAR file with the following structure:

warfile
|
|-META-INF
|    |- beans.xml
|
|-WEB-INF
|    |-classes
|    |    |-acs.json
|    |    |-<custom classes/resources>
|    |
|    |-lib
|       |-acs-loader-jee.jar
|       |-<additional libraries>

The acs.json file contains the JSON representation of the Active Collection Source configuration.

The acs-loader-jee.jar acts as a bootstrapper to load and register the Active Collection Source.

If custom active collection source and/or active change listeners are defined, then the associated classes and resources can be defined in the WEB-INF/classes folder or within additional libraries located in the WEB-INF/lib folder.

A maven pom.xml that will create this structure is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  	<modelVersion>4.0.0</modelVersion>
	<groupId>....</groupId>
	<artifactId>....</artifactId>
	<version>....</version>
	<packaging>war</packaging>
	<name>....</name>

	<properties>
		<rtgov.version>....</rtgov.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.overlord.rtgov.active-queries</groupId>
			<artifactId>active-collection</artifactId>
			<version>${rtgov.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.overlord.rtgov.active-queries</groupId>
			<artifactId>acs-loader-jee</artifactId>
			<version>${rtgov.version}</version>
		</dependency>
		....
	</dependencies>

</project>

If deploying in JBoss Application Server, then the following fragment also needs to be included, to define the dependency on the core Overlord rtgov modules:

.....
	<build>
		<finalName>....</finalName>
		<plugins>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<failOnMissingWebXml>false</failOnMissingWebXml>
 					<archive>
						<manifestEntries>
							<Dependencies>deployment.overlord-rtgov.war</Dependencies>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>
	.....

The Active Collection Source is deployed within the OSGi container as a JAR file with the following structure:

jarfile
|
|-META-INF
|    |- beans.xml
|
|-acs.json
|-acs-loader-osgi.jar
|-<custom classes/resources>
|-<additional libraries>

The acs.json file contains the JSON representation of the Active Collection Source configuration.

The acs-loader-osgi.jar acts as a bootstrapper to load and register the Active Collection Source.

If custom active collection source and/or active change listeners are defined, then the associated classes, resources and additional libraries can be located in the top level folder.

A maven pom.xml that will create this structure is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  	<modelVersion>4.0.0</modelVersion>
	<groupId>....</groupId>
	<artifactId>....</artifactId>
	<version>....</version>
	<packaging>war</packaging>
	<name>....</name>

	<properties>
		<rtgov.version>....</rtgov.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.overlord.rtgov.active-queries</groupId>
			<artifactId>active-collection</artifactId>
			<version>${rtgov.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.overlord.rtgov.active-queries</groupId>
			<artifactId>acs-loader-osgi</artifactId>
			<version>${rtgov.version}</version>
		</dependency>
		....
	</dependencies>

	<build>
		<finalName>....</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
 				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
						<Bundle-Version>${project.version}</Bundle-Version>
						<Bundle-Activator>org.overlord.rtgov.acs.loader.osgi.ACSActivator</Bundle-Activator>
						<Import-Package>
							!javax.inject.*,!javax.enterprise.*,!javax.persistence.*,
                            ....,
                            *
						</Import-Package>
						<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
					</instructions>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>

As discussed in the preceding section, an Active Collection Source can be configured to obtain information from an Event Processor Network, which is then placed in the associated Active Collection. This section will explain in more detail how this can be done using the specific Active Collection Source implementation.

[
  {
    "@class" : "org.overlord.rtgov.active.collection.epn.EPNActiveCollectionSource",
    "name" : "Situations",
    "type" : "List",
    "itemExpiration" : 40000,
    "maxItems" : 0,
    "subject" : "Situations",
    "activeChangeListeners" : [ {
        "@class" : "org.overlord.rtgov.active.collection.jmx.JMXNotifier",
    	"objectName" : "overlord.rtgov.services:name=Situations",
    	"descriptionScript" : "SituationDescription.mvel",
    	"insertTypeScript" : "SituationType.mvel"
    } ],
    "derived": [ {
        "name": "FilteredSituations",
        "predicate": {
            "type": "MVEL",
            "expression": "map = context.getMap(\"IgnoredSituationSubjects\"); if (map == null) { return false; } return !map.containsKey(subject);"
        },
        "properties" : {
            "active" : false
        }
    } ]
  }
]

This configuration shows an example of an Active Collection Source using the org.overlord.rtgov.active.collection.epn.EPNActiveCollectionSource implementation. The additional fields associated with this implementation are:

FieldDescription

subject

The EPN subject upon which the information has been published.

An example Event Processor Network configuration that will publish information on the subject (e.g. Situations) specified in the Active Collection Source configuration above is:

{
  "name" : "SLAMonitorEPN",
  "version" : "${project.version}",
  "subscriptions" : [ {
    "nodeName" : "SLAViolations",
    "subject" : "ServiceResponseTimes"
  } ],
  "nodes" : [
    {
      "name" : "SLAViolations",
      "sourceNodes" : [ ],
      "destinationSubjects" : [ "Situations" ],
      "maxRetries" : 3,
      "retryInterval" : 0,
      "eventProcessor" : {
        "@class" : "org.overlord.rtgov.ep.drools.DroolsEventProcessor",
        "ruleName" : "SLAViolation",
        "parameters" : {
        	"levels" : [
        		{
        			"threshold" : 400,
        			"severity" : "Critical"
        		},
        		{
        			"threshold" : 320,
        			"severity" : "High"
        		},
        		{
        			"threshold" : 260,
        			"severity" : "Medium"
        		},
        		{
        			"threshold" : 200,
        			"severity" : "Low"
        		}
        	]
        }
      },
      "predicate" : null,
      "notifications" : [ {
      	 "type" : "Processed",
      	 "subject" : "SituationsProcessed"
      },{
      	 "type" : "Results",
      	 "subject" : "Situations"
      } ]
    }
  ]
}

The Active Collections configured within the runtime governance server can be accessed via a REST service, by POSTing the JSON representation of a query specification to the URL: <host>/overlord-rtgov/acm/query

This service used basic authentication, with a default username admin and password overlord.

The Query Specification (see org.overlord.rtgov.active.collection.QuerySpec in the API documentation) is comprised of the following information:

AttributeDescription

collection

The active collection name.

predicate

Optional. If defined with the parent name, then can be used to derive a child collection that filters its parent’s content (and notifications) based on the predicate.

parent

Optional. If deriving a child collection, this field defines the parent active collection from which it will be derived.

maxItems

Defines the maximum number of items that should be returned in the result, or 0 if unrestricted.

truncate

If a maximum number of items is specified, then this field can be used to indicate whether the Start or End of the collection should be truncated.

style

Allows control over how the results are returned. The value Normal means as it appears in the collection. The value Reversed means the order of the contents should be reversed.

properties

Map of key/value pairs, used when creating a derived collection. Currently the only relevant property is a boolean called active, defaults to true, which can be used to force queries on the derived collection to be evaluated when information requested, in situations where the predicate is based on volatile information.

The collection field defines the name of the collection - either an existing collection name, or if defining the predicate and parent fields, then this field defines the name of the derived collection to be created.

The predicate field refers to a component that implements a predicate interface - the implementation is defined based on the type field. Currently only a MVEL based implementation exists, with a single field expression defining the predicate as a string.

For example,

{
    "parent" : "ServiceResponseTimes",
    "maxItems" : 5000,
    "collection" : "OrderServiceSRT",
    "predicate" : {
        "type" : "MVEL",
        "expression" : "serviceType == \"{urn:switchyard-quickstart-demo:orders:0.1.0}OrderService\" && operation == \"submitOrder\""
    },
    "truncate" : "End",
    "style" : "Reversed"
}

If the Active Collection Manager (ACM) does not have a collection named OrderServiceSRT, then it will use the supplied defaults to create the derived collection. If the collection already exists, then the contents will simply be returned, allowing multiple users to share the same collection.

The list of objects returned by the query will be represented in JSON.

This section describes the list of Active Collections that are provided "out of the box".

This active collection is a map of Service Type name to org.overlord.rtgov.analytics.service.ServiceDefinition objects. More details on this class can be found in the API documentation.

An example of a service definition, represented in JSON is:

{
    "serviceType":"{http://www.jboss.org/examples}OrderService",
    "operations":[{
        "name":"buy",
        "metrics":{
            "count":30,
            "average":1666,
            "min":500,
            "max":2500
        },
        "requestResponse":{
            "metrics":{
                "count":10,
                "average":1000,
                "min":500,
                "max":1500
            },
            "invocations":[{
                "serviceType":"{http://www.jboss.org/examples}CreditAgencyService",
                "metrics":{
                    "count":10,
                    "average":500,
                    "min":250,
                    "max":750
                },
                "operation":"checkCredit"
            }]
        },
        "requestFaults":[{
            "fault":"UnknownCustomer",
            "metrics":{
                "count":20,
                "average":2000,
                "min":1500,
                "max":2500
             }
        }]
    }],
    "metrics":{
        "count":30,
        "average":1666,
        "min":500,
        "max":2500
    }
}

The list of service definitions returned from this active collection, and the information they represent (e.g. consumed services), represents a near term view of the service activity based on the configuration details defined in the collection’s active collection source. Therefore, if (for example) a service has not invoked one of its consumed services within the time period of interest, then its details will not show in the service definition.

This information is simply intended to show the service activity that has occurred in the recent history, as a means of monitoring the real-time situation to deal with emerging problems.

The duration over which the information is retained is determined by two properties in the ServiceDefinitions active collection source configuration - the "scheduledInterval" (in milliseconds) which dictates how often a snapshot of the current service definition information is stored, and the "maxSnapshots" property which defines the maximum number of snapshots that should be used. So the duration of information retained can be calculated as the scheduled interval multiplied by the maximum number of snapshots.

This section describes the "out of the box" additional services that are provided.

Note

As of version 2.0, the report server is deprecated, indicating that it will be removed from the project in a future release. Therefore we suggest that you should not start using it, and if already using it, plan to migrate off this capability in the new future. The capability is being deprecated as more sophisticated analysis and reporting can be achieved through the Kibana/Elasticsearch tools, which are now integrated from RTGov 2.0.

The "Report Server" service is used to generate instances of a report whose definition has previously been deployed to the server. This section will explain how to configure and deploy a report definition, and then how to generate the report instances.

The first step is to specify a JSON representation of the org.overlord.rtgov.reports.ReportDefinition class (see API documentation for details).

[
  {
    "name" : "SLAReport",
    "generator" : {
      "@class" : "org.overlord.rtgov.reports.MVELReportGenerator",
       "scriptLocation" : "SLAReport.mvel"
    }
  }
]

The report definition only contains the name of the report, and the definition of the generator. In this case, the org.overlord.rtgov.reports.MVELReportGenerator implementation of the report generator has been used, which also includes a property to define the location of the report script (e.g. SLAReport.mvel). This MVEL SLA report script can be found in the samples/sla/report folder.

JEE Container

The Report Definition is deployed within the JEE container as a WAR file with the following structure:

warfile
|
|-META-INF
|    |- beans.xml
|
|-WEB-INF
|    |-classes
|    |    |-reports.json
|    |    |-<custom classes/resources>
|    |
|    |-lib
|       |-reports-loader-jee.jar
|       |-<additional libraries>

As described above, the reports.json file contains the JSON representation of the report definition configuration.

The reports-loader-jee.jar acts as a bootstrapper to load and register the Report Definition.

If custom report generators or scripts are defined, then the associated classes and resources can be defined in the WEB-INF/classes folder or within additional libraries located in the WEB-INF/lib folder.

A maven pom.xml that will create this structure is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  	<modelVersion>4.0.0</modelVersion>
	<groupId>....</groupId>
	<artifactId>....</artifactId>
	<version>....</version>
	<packaging>war</packaging>
	<name>....</name>

	<properties>
		<rtgov.version>....</rtgov.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.overlord.rtgov.activity-analysis</groupId>
			<artifactId>reports-loader-jee</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.overlord.rtgov.activity-analysis</groupId>
			<artifactId>reports</artifactId>
			<version>${project.version}</version>
			<scope>test</scope>
		</dependency>
		....
	</dependencies>

</project>

If deploying in JBoss Application Server, then the following fragment also needs to be included, to define the dependency on the core Overlord Runtime Governance modules:

.....
	<build>
		<finalName>slamonitor-epn</finalName>
		<plugins>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<failOnMissingWebXml>false</failOnMissingWebXml>
 					<archive>
						<manifestEntries>
							<Dependencies>deployment.overlord-rtgov.war</Dependencies>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>
	.....

The "Service Dependency" service is used to return a service dependency graph as a SVG image. The graph represents the invocation and usage links between services (and their operations), and provides a color-coded indication of areas that require attention. Where situations have been detected against services or their operations, this will be flagged on the service dependency graph with an appropriate colour reflecting their severity.

The URL for the service’s REST GET request is: <host>/overlord-rtgov/service/dependency/overview?width=<value>

The service uses basic authentication, with a default username admin and password overlord.

This service has the following query parameters:

ParameterDescription

width

Represents the optional image width. If the width is below a certain threshold, then a summary version of the dependency graph will be provided without text or tooltips (used to display metrics).

The severity levels used for the graph nodes and links can be customized by creating a MVEL script. A default script is provided within the overlord-rtgov.war, which can be used as a template. The script is called SeverityAnalyzer.mvel and is located within the /WEB-INF/classes folder of the overlord-rtgov.war archive.

An example of the contents of this script is:

Severity severity=Severity.Normal;

if (summary != null && latest != null && summary.getAverage() > 0) {
	double change=latest.getAverage()/summary.getAverage();

	if (change > 0) {

	    if (change > 3.0) {
	        severity = Severity.Critical;
	    } else if (change > 2.2) {
	        severity = Severity.Serious;
	    } else if (change > 1.8) {
	        severity = Severity.Error;
	    } else if (change > 1.4) {
	        severity = Severity.Warning;
	    } else if (change > 1.2) {
	        severity = Severity.Minor;
	    }
	}
}

return (severity);

The script returns a value of type org.overlord.rtgov.service.dependency.presentation.Severity, which is automatically available as an imported class for use by the script.

The script takes four variables:

VariableDescription

summary

The summary metric to be evaluated.

history

The list of recent metrics, merged to produce the summary metric.

latest

The latest metric.

component

The service definition component associated with the metric. This variable is not used within the example script above.

If a customized script is created, then its location can be specified in the MVELSeverityAnalyzer.scriptLocation property in the overlord-rtgov.properties configuration file.

The "Situation Manager" service is used to determine whether situations associated with a particular subject (i.e. service) should be displayed to users via the Situations gadget. The service supports two operations.

The service uses basic authentication, with a default username admin and password overlord.

The Activity Collector mechanism is responsible for collecting activity event information from within a particular execution environment and reporting it as efficiently as possible to the Activity Server.

This section explains how different Activity Collector implementations may be administered.

There are two aspects to managing the Active Collections mechanism, the manager component and the collections themselves. This section will outline the management capabilities associated with both.