Installing the Alerts Service

Transformer’s Alerts Service hosts and manages containers of application notifications. Caplin FX Suite uses the Alerts Service to manage order notifications.

Notifications are queued until their recipients read and dismiss them. You can use the com.caplin.datasource.notification API to post notifications to the service, or you can use StreamLink to set an Alerts Service Trigger, which generates a notification when a condition is met.

If you are upgrading to Caplin Platform 7, see Upgrading to Caplin Platform 7.

Requirements

Transformer version required:

  • Alerts Service 7 requires Transformer 7

  • Alerts Service 6.2 requires Transformer 6.2

Upgrading to the Alerts Service 7

The Alerts Service 7 persists notifications in a different format to the Alerts Service 6.2. Migrating persisted notifications from Transformer 6.2 to Transformer 7.0 requires an extra step to convert the persisted data to the new format.

For detailed upgrade instructions, see Upgrading to the Caplin Platform 7.

Deploying the Alerts Service 7

To install Transformer’s Alerts Service 7:

  1. Activate and configure Transformer 7’s Persistence Service. See Activating the Persistence Service 7.

  2. Copy the Alerts Service 7 installation kit to your Deployment Framework’s kits/ directory

  3. Run the command below from the root of your Deployment Framework to deploy the Alerts Service:

    ./dfw deploy
  4. If you have configured the Persistence Service to persist data to a relational database server, create the database tables required by the Alerts Service.

    A reference DDL script for SQLite can be found at kits/AlertsService/Transformer/etc/bootstrap.sql. Adapt this script to the syntax and data types of your relational database server.

    kits/AlertsService/Transformer/etc/bootstrap.sql
    CREATE TABLE IF NOT EXISTS TF_TRIGGER_PERSISTENCE (
        TRIGGER_USER VARCHAR(250) NOT NULL,
        TRIGGER_ID VARCHAR(250) NOT NULL,
        TRIGGER_DATA VARCHAR(4096) NOT NULL,
        TRIGGER_CREATIONTIME LONG,
        PRIMARY KEY (TRIGGER_USER, TRIGGER_ID)
    );
    
    CREATE TABLE IF NOT EXISTS TF_NOTIFICATION_PERSISTENCE (
        NOTIFICATION_USER VARCHAR(250) NOT NULL,
        NOTIFICATION_ID VARCHAR(250) NOT NULL,
        NOTIFICATION_DATA VARCHAR(4096) NOT NULL,
        NOTIFICATION_CREATIONTIME LONG,
        PRIMARY KEY (NOTIFICATION_USER, NOTIFICATION_ID)
    );
  5. Run the command below from the root of your Deployment Framework to restart components in your framework:

    ./dfw start

Deploying the Alerts Service 6

To install Transformer’s Alerts Service 6:

  1. Activate and configure Transformer 6.2’s Persistence Service. See Activating the Persistence Service 6.2.

  2. Copy the Alerts Service 6 installation kit to your Deployment Framework’s kits/ directory.

  3. Run the command below from the root of your Deployment Framework to deploy the Alerts Service:

    ./dfw deploy
  4. Run the command below from the root of your Deployment Framework to restart components in your framework:

    ./dfw start

Configuring permissions

To allow users to interact with the Alerts Service, configure Liberator’s Permissioning Service according to the specification below. For more information on permissioning, see User Authentication and Permissioning.

Rules

Define rules that trigger when users contribute to the Alerts Service’s control subjects. The strings used for the 'permission namespace' and the 'action' are arbitrary; you are free to customise them to your own naming scheme.

Message Subject Rule Type Permission Namespace Action Action Ref Product Ref

^/PRIVATE/NOTIFICATIONS/%u/CONTROL

WRITE

TRANSFORMER_ALERTS_SERVICE

NOTIFICATION_OPERATION

-

ALL_PRODUCTS

^/PRIVATE/ALERTS/%u/TRIGGERCONTROL/.*

WRITE

TRANSFORMER_ALERTS_SERVICE

ALERT_OPERATION

-

ALL_PRODUCTS

Permissions

Assign users the following permissions.

Product Set Permission Namespace Action Authorisation

.*

TRANSFORMER_ALERTS_SERVICE

NOTIFICATION_OPERATION

ALLOW

.*

TRANSFORMER_ALERTS_SERVICE

ALERT_OPERATION

ALLOW

^/PRIVATE/NOTIFICATIONS/%u/.*

-

VIEW

ALLOW

^/FILTER/PRIVATE/NOTIFICATIONS/%u/.*

-

VIEW

ALLOW

^/PRIVATE/ALERTS/%u/.*

-

VIEW

ALLOW

Java Permissioning Integration API example

See the code below for an example of how to set rules and permissions using the Java Permissioning Integration API.

// Rules
permissioningDataSource.createActionRule("^/PRIVATE/NOTIFICATIONS/%u/CONTROL",
    "TRANSFORMER_ALERTS_SERVICE", "NOTIFICATION_OPERATION", Constants.ALL_PRODUCTS);
permissioningDataSource.createActionRule("^/PRIVATE/ALERTS/%u/TRIGGERCONTROL/.*",
    "TRANSFORMER_ALERTS_SERVICE", "ALERT_OPERATION", Constants.ALL_PRODUCTS);

// WRITE permissions
java.util.HashSet<String> allProducts = new java.util.HashSet<String>();
allProducts.add(".*");
user.permit(allProducts, "TRANSFORMER_ALERTS_SERVICE", "NOTIFICATION_OPERATION");
user.permit(allProducts, "TRANSFORMER_ALERTS_SERVICE", "ALERT_OPERATION");

// VIEW permissions
java.util.HashSet<String> viewProductSets = new java.util.HashSet<String>();
viewProductSets.add("^/PRIVATE/NOTIFICATIONS/%u/.*");
viewProductSets.add("^/FILTER/PRIVATE/NOTIFICATIONS/%u/.*");
viewProductSets.add("^/PRIVATE/ALERTS/%u/.*");
user.permit(viewProductSets, Constants.DEFAULT_PERMISSION_NAMESPACE, "VIEW");

See also: