Class InitializedAmLink
- java.lang.Object
-
- org.forgerock.openig.tools.notifications.ws.link.InitializedAmLink
-
- All Implemented Interfaces:
AmLink,AmLinkListener
public class InitializedAmLink extends Object implements AmLink, AmLinkListener
Subscribe to a set of initial topics while starting.The following issues may occur while starting, and so fail the start promise:
- The previous
AmLinkfails to start - At least one element of
managedTopicscan't be sent to AM - At least one AM Acknowledgment is not successful
- A disconnection happens before/during the initial subscription phase: see #2 and #3
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.forgerock.openig.tools.notifications.ws.link.AmLink
AmLink.AmLinkSupplier, AmLink.ResilientAmLinkSupplier
-
Nested classes/interfaces inherited from interface org.forgerock.openig.tools.notifications.ws.link.AmLinkListener
AmLinkListener.ResilientAmLinkListener
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Promise<Void,Exception>close()Close theAmLinkand its associated resources.static AmLink.AmLinkSupplierinitializedAmLinkSupplier(AmLink.AmLinkSupplier delegateSupplier, Set<String> initTopics)Builds a supplier ofInitializedAmLink.voidonDisconnection()The handler to call in case of a disconnection.voidonNotification(Notification notification)The notification handler, will receive all notifications sent by AM.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.
-
onDisconnection
public void onDisconnection()
Description copied from interface:AmLinkListenerThe handler to call in case of a disconnection. When this handler is called, the instance is considered as closed. Can only be called after the start promise successful completion, and before every ongoing (un)subscribe promise failure.- Specified by:
onDisconnectionin interfaceAmLinkListener
-
onNotification
public void onNotification(Notification notification)
Description copied from interface:AmLinkListenerThe notification handler, will receive all notifications sent by AM. Duplicate notifications may occur.- Specified by:
onNotificationin interfaceAmLinkListener- Parameters:
notification- the received notification
-
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.
-
initializedAmLinkSupplier
public static AmLink.AmLinkSupplier initializedAmLinkSupplier(AmLink.AmLinkSupplier delegateSupplier, Set<String> initTopics)
Builds a supplier ofInitializedAmLink.- Parameters:
delegateSupplier- the delegated AM link supplierinitTopics- the topics which have to be subscribed to before being started.- Returns:
- a supplier of
InitializedAmLink.
-
-