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 Subscriptionbegin()Used to start a chain ofSubscriptioninstances.default Subscriptionchain(Subscription other) Chains thisSubscriptionto the other so that both will be unsubscribed at the same time.voidUnsubscribes this subscription.
-
Method Details
-
unsubscribe
void unsubscribe()Unsubscribes this subscription. Following this call, no future events will fire. -
chain
Chains thisSubscriptionto 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 otherSubscriptionto which to chain this- Returns:
- a new
Subscriptionthat chains the this and the other.
-
begin
Used to start a chain ofSubscriptioninstances. This returns a no-op subscription which serves as the start of a chain.- Returns:
- a dummy
Subscription
-