Package dev.getelements.elements.sdk
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.
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 Summary
Modifier and TypeMethodDescriptionstatic Subscription
begin()
Used to start a chain ofSubscription
instances.default Subscription
chain
(Subscription other) Chains thisSubscription
to the other so that both will be unsubscribed at the same time.void
Unsubscribes this subscription.
-
Method Details
-
unsubscribe
void unsubscribe()Unsubscribes this subscription. Following this call, no future events will fire. -
chain
Chains thisSubscription
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 otherSubscription
to which to chain this- Returns:
- a new
Subscription
that chains the this and the other.
-
begin
Used to start a chain ofSubscription
instances. This returns a no-op subscription which serves as the start of a chain.- Returns:
- a dummy
Subscription
-