Interface Subscription

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Subscription
Returned from the various subscribe calls. This interface represents an abract means to manage the subscription to a particular event. The underlying implementation of the Subscription indicates the specific semantics. Beyond what is documented here, make no assumptions as to the underlying implementation (eg thread safety) or its behavior.
  • Method Details

    • unsubscribe

      void unsubscribe()
      Unsubscribes this subscription. Following this call, no future events will fire.
    • chain

      default Subscription chain(Subscription other)
      Chains this Subscription to the other so that both will be unsubscribed at the same time. Useful for if you wish to multiple related messages but want to easily unwind the subscription in one go.
      Parameters:
      other - the other Subscription to which to chain this
      Returns:
      a new Subscription that chains the this and the other.
    • begin

      static Subscription begin()
      Used to start a chain of Subscription instances. This returns a no-op subscription which serves as the start of a chain.
      Returns:
      a dummy Subscription