public interface NotificationChannel
The NotificationChannel is a notification communication channel associated with a particular user. It allows your application to add and remove
Notification
s for a user which will be received by a front end application.
The channel caches all sent messages and handles requests for cached Notifications automatically.
When a notification is removed, it is removed from the cache and the user is automatically unsubscribed from it.
It enters your application through the NotificationApplicationListener.notificationChannelOpened(com.caplin.datasource.notification.NotificationChannel)
callback.
Modifier and Type | Method and Description |
---|---|
void |
closeChannel()
Closes the channel.
|
java.lang.String |
getSubject()
Returns the subject for the channel.
|
java.lang.String |
getUsername()
Returns the username for the channel
|
void |
removeNotification(java.lang.String uniqueId)
Removes the
Notification from the internal cache and sends a container remove so that this
notification is no longer requested when the channel is subscribed to. |
void |
removeNotifications(java.util.List<java.lang.String> uniqueIds)
Removes
Notification s from the internal cache and sends a container remove so that these
notifications are no longer requested when the channel is subscribed to. |
void |
sendEmptyNotificationContainer()
Sends an empty container on the channel.
|
void |
sendNotification(Notification notification)
Adds the
Notification to the internal cache and sends a container add so that this
notification is requested when the channel is subscribed to. |
void |
sendNotificationContainerStatusOk()
Sends a status ok on the channel.
|
void |
sendNotificationContainerStatusStale()
Sends a status stale on the channel.
|
void |
sendNotificationNotFound(java.lang.String uniqueId)
Sends a not found for a
Notification . |
void |
sendNotifications(java.util.List<Notification> items)
Adds
Notification s to the internal cache and sends a container add so that these
items are requested when the channel is subscribed to. |
void |
sendNotificationStatusOk(java.lang.String uniqueId)
Send status ok for a
Notification . |
void |
sendNotificationStatusStale(java.lang.String uniqueId)
Send status stale for a
Notification . |
void |
setNotificationChannelListener(NotificationChannelListener listener)
Your application SHOULD set a
NotificationChannelListener on the channel. |
void closeChannel()
Closes the channel.
Sends a Subject Not Found on the channel's subject to let subscribers know that it is no longer serviced.
java.lang.String getSubject()
Returns the subject for the channel.
java.lang.String getUsername()
Returns the username for the channel
void removeNotification(java.lang.String uniqueId)
Removes the Notification
from the internal cache and sends a container remove so that this
notification is no longer requested when the channel is subscribed to.
uniqueId
- of the item to removevoid removeNotifications(java.util.List<java.lang.String> uniqueIds)
Removes Notification
s from the internal cache and sends a container remove so that these
notifications are no longer requested when the channel is subscribed to.
uniqueIds
- of the items to removevoid sendNotification(Notification notification)
Adds the Notification
to the internal cache and sends a container add so that this
notification is requested when the channel is subscribed to.
If an notification with the same unique id already exists in the internal cache then that item's fields will be updated with this one's. This will then trigger an update for any users currently subscribed to this item.
notification
- to sendvoid sendNotificationNotFound(java.lang.String uniqueId)
Sends a not found for a Notification
.
Specifically for the case where there is more than one NotificationProvider.
Sent in response to a NotificationChannelListener.onNotificationRequest(com.caplin.datasource.notification.NotificationChannel, java.lang.String)
when the item requested is not serviceable by your application.
uniqueId
- of item that cannot be serviced by your application.void sendNotifications(java.util.List<Notification> items)
Adds Notification
s to the internal cache and sends a container add so that these
items are requested when the channel is subscribed to.
If any items with the same unique id already exists in the internal cache then these items fields will be updated with these one. This will then trigger an update for any users currently subscribed to these items.
items
- to sendvoid sendNotificationStatusOk(java.lang.String uniqueId)
Send status ok for a Notification
.
Under normal circumstances this method is not used.
uniqueId
- of the message whose status is OKvoid sendNotificationStatusStale(java.lang.String uniqueId)
Send status stale for a Notification
.
Under normal circumstances this method is not used.
uniqueId
- of the message whose status is STALEvoid sendNotificationContainerStatusOk()
Sends a status ok on the channel.
Under normal circumstances this method is not used.
void sendNotificationContainerStatusStale()
Sends a status stale on the channel.
Under normal circumstances this method is not used.
void sendEmptyNotificationContainer()
Sends an empty container on the channel.
Invoke when a NotificationApplicationListener.notificationChannelOpened(com.caplin.datasource.notification.NotificationChannel)
callback is received and there are currently no Notification
s to be added for the channel.
I.e. A NotificationApplicationListener.notificationChannelOpened(com.caplin.datasource.notification.NotificationChannel)
for a historic trade data
NotificationChannel for a user who has not yet traded would be serviced with this method.
void setNotificationChannelListener(NotificationChannelListener listener)
Your application SHOULD set a NotificationChannelListener
on the channel.
On this listener, your application will receive callbacks on requests for Notifications not in the cache and when a
front-end client sends actions in response to the notification.
See NotificationConfiguration
for information about having a distributed notification provision,
the scenario where a request could come in for an item not in cache.
listener
- to receive requests for items not already cached by the NotificationAPIPlease send bug reports and comments to Caplin support