public final class CTSNotificationBroker extends Object implements NotificationBroker
When publishing, notifications are written to the CTS. A continuous
query listener ContinuousQueryListener
responds to new notifications
in the CTS and passes them on to interested subscribers.
This implementation uses a local-server broker to handle the brokerage of messages that come in from the CTS.
Constructor and Description |
---|
CTSNotificationBroker(CTSPersistentStore store,
NotificationBroker localBroker,
int queueSize,
long tokenExpirySeconds,
long publishFrequencyMilliseconds,
AMExecutorServiceFactory executorServiceFactory)
Constructs a new broker.
|
Modifier and Type | Method and Description |
---|---|
boolean |
publish(Topic topic,
org.forgerock.json.JsonValue notification)
Publish passes the notification onto subscribers of the topic.
|
void |
shutdown()
Initiates an orderly shutdown in which previously published
notifications are delivered, but no new notifications will be accepted.
|
Subscription |
subscribe(Consumer consumer)
Creates a new subscription that is initially not bound to any topics.
|
@Inject public CTSNotificationBroker(CTSPersistentStore store, @Named(value="localBroker") NotificationBroker localBroker, @Named(value="ctsQueueSize") int queueSize, @Named(value="tokenExpirySeconds") long tokenExpirySeconds, @Named(value="publishFrequencyMilliseconds") long publishFrequencyMilliseconds, AMExecutorServiceFactory executorServiceFactory)
store
- a CTS persistent store that notifications will be written to and read fromlocalBroker
- a local-server broker used to propagate messages to local subscribersqueueSize
- the size of the queue of notifications waiting to be written to the CTStokenExpirySeconds
- the number of seconds that a notification will live in the CTS before it is deletedpublishFrequencyMilliseconds
- the number of milliseconds between each publish to the CTSexecutorServiceFactory
- an executor service factory for scheduling the publish taskpublic boolean publish(Topic topic, org.forgerock.json.JsonValue notification)
NotificationBroker
Publishing notifications may fail and this is signalled by returning false.
publish
in interface NotificationBroker
topic
- topicnotification
- notificationpublic Subscription subscribe(Consumer consumer)
NotificationBroker
The given consumer will be called for each notification that is published to any of the bound topics.
subscribe
in interface NotificationBroker
consumer
- a consumer that will be called once per published notificationpublic void shutdown()
NotificationBroker
shutdown
in interface NotificationBroker
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.