Package com.caplin.datasource.notification


package com.caplin.datasource.notification

This package contains the public elements of the Notification API.

The NotificationProvider is the main entry point of the API. You instantiate one providing an unstarted datasource, NotificationConfiguration object and an implementation of the NotificationApplicationListener interface. @see NotificationProvider

Notification API Overview

The Notification API allows your application to send notifications to users of a front-end trading application.

With the API, your application can open a unique channel of communication for each user, send that user notifications with arbitrary fields and allow the user to respond with actions for each notification received. Examples of notifications you may want to send include system level notifications, such as a service going down or trade life-cycle events, such as order fills.

The StreamLink Alerts API provides a means of integrating with with the Notification API. It allows a user to subscribe to their NotifcationChannel, prompting a call into the NotificationApplicationListener with the Notification API's representation of that channel. The StreamLink Alerts API can be used to send the preconfigured action, 'DISMISS', or any other custom action.

The 'DISMISS' action is the only action to have automatic behaviour associated with it. When a 'DISMISS' is sent by the StreamLink Alerts API, the notification in question will be removed from the cache, and that user will be unsubscribed from that Notification.

Under the hood, a NotificationChannel is a container on the subject /PRIVATE/NOTIFICATIONS/%u/CONTAINER. The channel is populated with Notification records identified by sourceName and user provided unique id. The NotificationProvider allows multiple NotificationChannels, each associated with a user, to be serviced on a single namespace.

Key Concepts

Source Name - identifies the NotificationProvider in logs and over jmx. Passed into constructor of NotificationConfiguration. NotificationChannel - corresponds to a set of notifications for a single user. Notifications are added to and removed from this. Notification - a notification with arbitrary fields sent to the user subscribed to the NotificationChannel

Getting Started

Instantiating a NotificationProvider

Here is how you would instantiate a NotificationProvider given a NotificationApplicationListener called NotificationGenerator:

Sample ApplicationListener

Here is the example ApplicationListener, NotificationGenerator: