Interface SubscriptionBuilder<T>
- Type Parameters:
T- the handled / event type
- All Known Subinterfaces:
MergedSubscriptionBuilder<T>,SingleSubscriptionBuilder<T>
public interface SubscriptionBuilder<T>
Abstract
Subscription builder.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription@NotNull SubscriptionBuilder<T>expireAfter(long maxCalls) Sets the number of calls until the handler will automatically be unregistered@NotNull SubscriptionBuilder<T>expireAfter(long duration, @NotNull TimeUnit unit) Sets the expiry time on the handler@NotNull SubscriptionBuilder<T>Add a expiry predicate.@NotNull SubscriptionBuilder<T>Adds a filter to the handler.
-
Field Details
-
DEFAULT_EXCEPTION_CONSUMER
-
-
Method Details
-
expireIf
Add a expiry predicate.- Parameters:
predicate- the expiry test- Returns:
- ths builder instance
-
expireAfter
@NotNull @NotNull SubscriptionBuilder<T> expireAfter(long duration, @NotNull @NotNull TimeUnit unit) Sets the expiry time on the handler- Parameters:
duration- the duration until expiryunit- the unit for the duration- Returns:
- the builder instance
- Throws:
IllegalArgumentException- if duration is not greater than or equal to 1
-
expireAfter
Sets the number of calls until the handler will automatically be unregisteredThe call counter is only incremented if the event call passes all filters and if the handler completes without throwing an exception.
- Parameters:
maxCalls- the number of times the handler will be called until being unregistered.- Returns:
- the builder instance
- Throws:
IllegalArgumentException- if maxCalls is not greater than or equal to 1
-
filter
Adds a filter to the handler.An event will only be handled if it passes all filters. Filters are evaluated in the order they are registered.
- Parameters:
predicate- the filter- Returns:
- the builder instance
-