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 theWebSocketAdapter
and run subscribe and unsubscribe operations on it.This
AmLink
complete features list is:- Start and stop a
WebSocketAdapter
- Send (un-)subscriptions message over a
WebSocketAdapter
- Handle (un-)subscription Acknowledgments sent by AM
- Translate
JsonValue
notification messages intoNotification
The following issues may occur while starting, and so fail promises:
- The
WebSocketAdapter
fails 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.AmLinkSupplier
asSupplier(WebSocketAdapter wsAdapter)
Builds a supplier ofDirectAmLink
.Promise<Void,Exception>
close()
Close theAmLink
and its associated resources.void
onDisconnection()
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:AmLink
Close theAmLink
and its associated resources. The instance can't be reused afterward.
-
onDisconnection
public void onDisconnection()
-
subscribe
public Promise<Void,Exception> subscribe(String topic)
Description copied from interface:AmLink
Subscribe 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:AmLink
Unsubscribe from an AM topic. After successful unsubscribe request, the notification consumer will stop receiving notifications on this topic.- Specified by:
unsubscribe
in 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
.
-
-