Class DirectAmLink

  • All Implemented Interfaces:
    AmLink

    public class DirectAmLink
    extends Object
    implements AmLink
    Manage the WebSocketAdapter and run subscribe and unsubscribe operations on it.

    This AmLink complete features list is:

    The following issues may occur while starting, and so fail promises:

    1. The WebSocketAdapter fails to start
    2. A disconnection happens while waiting for an Ack: all waiting Acks will be considered as failed, see #3
    3. An Ack is never received : THEN THIS PROMISE WILL NEVER BEEN COMPLETED
    • Method Detail

      • start

        public Promise<Void,​Exception> start()
        Description copied from interface: AmLink
        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.

        Specified by:
        start in interface AmLink
        Returns:
        A promise of this AmLink's start completion.
      • close

        public Promise<Void,​Exception> close()
        Description copied from interface: AmLink
        Close the AmLink and its associated resources. The instance can't be reused afterward.
        Specified by:
        close in interface AmLink
        Returns:
        A promise indicating the AmLink has been closed
      • 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.
        Specified by:
        subscribe in interface AmLink
        Parameters:
        topic - The AM topic to subscribe to.
        Returns:
        A promise of a successful subscription to the AM 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 interface AmLink
        Parameters:
        topic - The AM topic to un-subscribe from.
        Returns:
        A promise of a successful un-subscription to the AM topic.