Interface AmLink
-
- All Known Implementing Classes:
AutoReconnectAmLink,DirectAmLink,GracefulShutdownAmLink,InitializedAmLink,PeriodicallyRenewedAmLink,RetryableAmLink,StableAmLink,TopicMultiplexerAmLink
public interface AmLinkRepresents a link to AM notification service. This link must be started successfully before use and closed after use.There is no need to close an
AmLinkafter the triggering of the disconnection handler or a start failure.When an
AmLinkhas been closed or disconnected it can't be reused otherwise its behaviour is unspecified.Since the
AmLinkmay be disconnected, all ongoing promises will fail AFTER the call to the disconnection handler.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceAmLink.AmLinkSupplierA supplier of AM Link.static interfaceAmLink.ResilientAmLinkSupplierA supplier of Resilient AM Link.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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
-
start
Promise<Void,Exception> start()
Start theAmLink. TheAmLinkis considered ready for use only when the resulting promise has successfully completed. In case of a failed promise, the instance is considered as already closed.Note that notifications are guaranteed to be received AT LEAST once. Duplicate notification may occur.
- Returns:
- A promise of this
AmLink's start completion.
-
close
Promise<Void,Exception> close()
Close theAmLinkand its associated resources. The instance can't be reused afterward.- Returns:
- A promise indicating the
AmLinkhas been closed
-
subscribe
Promise<Void,Exception> subscribe(String topic)
Subscribe to an AM topic. After successful subscription, the notification consumer (supplied in will begin receiving notifications on this topic.- Parameters:
topic- The AM topic to subscribe to.- Returns:
- A promise of a successful subscription to the AM topic.
-
unsubscribe
Promise<Void,Exception> unsubscribe(String topic)
Unsubscribe from an AM topic. After successful unsubscribe request, the notification consumer will stop receiving notifications on this topic.- Parameters:
topic- The AM topic to un-subscribe from.- Returns:
- A promise of a successful un-subscription to the AM topic.
-
-