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.

  • Method Details

    • start

      Start the AmLink. The AmLink 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

      Close the AmLink 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.