Class DirectAmLink
- java.lang.Object
-
- org.forgerock.openig.tools.notifications.ws.link.DirectAmLink
-
- All Implemented Interfaces:
AmLink
public class DirectAmLink extends Object implements AmLink
Manage theWebSocketAdapterand run subscribe and unsubscribe operations on it.This
AmLinkcomplete features list is:- Start and stop a
WebSocketAdapter - Send (un-)subscriptions message over a
WebSocketAdapter - Handle (un-)subscription Acknowledgments sent by AM
- Translate
JsonValuenotification messages intoNotification
The following issues may occur while starting, and so fail promises:
- The
WebSocketAdapterfails to start - A disconnection happens while waiting for an Ack: all waiting Acks will be considered as failed, see #3
- An Ack is never received : THEN THIS PROMISE WILL NEVER BEEN COMPLETED
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.forgerock.openig.tools.notifications.ws.link.AmLink
AmLink.AmLinkSupplier, AmLink.ResilientAmLinkSupplier
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AmLink.AmLinkSupplierasSupplier(WebSocketAdapter wsAdapter)Builds a supplier ofDirectAmLink.Promise<Void,Exception>close()Close theAmLinkand its associated resources.Promise<Void,Exception>start()Start theAmLink.Promise<Void,Exception>subscribe(String topic)Subscribe to an AM topic.Promise<Void,Exception>unsubscribe(String topic)Unsubscribe from an AM topic.
-
-
-
Method Detail
-
close
public Promise<Void,Exception> close()
Description copied from interface:AmLinkClose theAmLinkand its associated resources. The instance can't be reused afterward.
-
subscribe
public Promise<Void,Exception> subscribe(String topic)
Description copied from interface:AmLinkSubscribe to an AM topic. After successful subscription, the notification consumer (supplied in will begin receiving notifications on this topic.
-
unsubscribe
public Promise<Void,Exception> unsubscribe(String topic)
Description copied from interface:AmLinkUnsubscribe from an AM topic. After successful unsubscribe request, the notification consumer will stop receiving notifications on this topic.- Specified by:
unsubscribein interfaceAmLink- Parameters:
topic- The AM topic to un-subscribe from.- Returns:
- A promise of a successful un-subscription to the AM topic.
-
asSupplier
public static AmLink.AmLinkSupplier asSupplier(WebSocketAdapter wsAdapter)
Builds a supplier ofDirectAmLink.- Parameters:
wsAdapter- The WebSocketAdapter to use.- Returns:
- a supplier of
DirectAmLink.
-
-