Class CTSNotificationBroker
- java.lang.Object
-
- org.forgerock.openam.notifications.integration.brokers.CTSNotificationBroker
-
- All Implemented Interfaces:
NotificationBroker
public final class CTSNotificationBroker extends Object implements NotificationBroker
Uses the CTS to propagate notifications across an OpenAM cluster.When publishing, notifications are written to the CTS. A continuous query listener
ContinuousQueryListenerresponds 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.
- Since:
- 14.0.0
-
-
Constructor Summary
Constructors Constructor Description CTSNotificationBroker(CTSPersistentStore store, NotificationBroker localBroker, int queueSize, long tokenExpirySeconds, long publishFrequencyMilliseconds, AMExecutorServiceFactory executorServiceFactory)Constructs a new broker.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanpublish(Topic topic, org.forgerock.json.JsonValue notification)Publish passes the notification onto subscribers of the topic.voidshutdown()Initiates an orderly shutdown in which previously published notifications are delivered, but no new notifications will be accepted.Subscriptionsubscribe(Consumer consumer)Creates a new subscription that is initially not bound to any topics.
-
-
-
Constructor Detail
-
CTSNotificationBroker
@Inject public CTSNotificationBroker(CTSPersistentStore store, @Named("localBroker") NotificationBroker localBroker, @Named("ctsQueueSize") int queueSize, @Named("tokenExpirySeconds") long tokenExpirySeconds, @Named("publishFrequencyMilliseconds") long publishFrequencyMilliseconds, AMExecutorServiceFactory executorServiceFactory)
Constructs a new broker.- Parameters:
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 task
-
-
Method Detail
-
publish
public boolean publish(Topic topic, org.forgerock.json.JsonValue notification)
Description copied from interface:NotificationBrokerPublish passes the notification onto subscribers of the topic. If there are no subscribers to the same topic, the notification is discarded.Publishing notifications may fail and this is signalled by returning false.
- Specified by:
publishin interfaceNotificationBroker- Parameters:
topic- topicnotification- notification- Returns:
- attempts to give some indication whether the topic was successfully published. False gives a guarantee that publication definitely failed.
-
subscribe
public Subscription subscribe(Consumer consumer)
Description copied from interface:NotificationBrokerCreates a new subscription that is initially not bound to any topics.The given consumer will be called for each notification that is published to any of the bound topics.
- Specified by:
subscribein interfaceNotificationBroker- Parameters:
consumer- a consumer that will be called once per published notification- Returns:
- a new subscriber
-
shutdown
public void shutdown()
Description copied from interface:NotificationBrokerInitiates an orderly shutdown in which previously published notifications are delivered, but no new notifications will be accepted. Invocation has no additional effect if already shut down.- Specified by:
shutdownin interfaceNotificationBroker
-
-