Interface AmLink
-
- All Known Implementing Classes:
AutoReconnectAmLink
,DirectAmLink
,GracefulShutdownAmLink
,InitializedAmLink
,PeriodicallyRenewedAmLink
,RetryableAmLink
,StableAmLink
,TopicMultiplexerAmLink
public interface AmLink
Represents 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
AmLink
after the triggering of the disconnection handler or a start failure.When an
AmLink
has been closed or disconnected it can't be reused otherwise its behaviour is unspecified.Since the
AmLink
may 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 interface
AmLink.AmLinkSupplier
static interface
AmLink.ResilientAmLinkSupplier
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Promise<Void,Exception>
close()
Close theAmLink
and 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
. TheAmLink
is 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 theAmLink
and its associated resources. The instance can't be reused afterward.- Returns:
- A promise indicating the
AmLink
has 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.
-
-