public abstract class Hooks extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Hooks.OperatorHook<T>
Filtering and Handling options to apply on a given
Publisher |
Modifier and Type | Method and Description |
---|---|
static void |
onErrorDropped(Consumer<? super Throwable> c)
Override global error dropped strategy which by default bubble back the error.
|
static void |
onNextDropped(Consumer<Object> c)
Override global data dropped strategy which by default throw
Exceptions.failWithCancel() |
static <T> void |
onOperator(Function<? super Hooks.OperatorHook<T>,? extends Hooks.OperatorHook<T>> onOperator)
|
static void |
onOperatorError(BiFunction<? super Throwable,Object,? extends Throwable> f)
Override global operator error mapping which by default add as suppressed exception
either data driven exception or error driven exception.
|
static void |
resetOnErrorDropped()
Reset global error dropped strategy to bubbling back the error.
|
static void |
resetOnNextDropped()
Reset global data dropped strategy to throwing via
Exceptions.failWithCancel() |
static void |
resetOnOperator()
Reset global "assembly" hook tracking
|
static void |
resetOnOperatorError()
Reset global operator error mapping to adding as suppressed exception.
|
public static void onErrorDropped(Consumer<? super Throwable> c)
c
- the Consumer
to apply to dropped errorspublic static void onNextDropped(Consumer<Object> c)
Exceptions.failWithCancel()
c
- the Consumer
to apply to data (onNext) that is droppedpublic static <T> void onOperator(Function<? super Hooks.OperatorHook<T>,? extends Hooks.OperatorHook<T>> onOperator)
Publisher
(Flux
or Mono
). The passed function provides
a base Hooks.OperatorHook
that can be used as a kind of builder to compose several
hooks or behaviors (eg. transverse logging). Hooks.OperatorHook.ignore()
can be
used to prevent all hooks from applying to a specific Publisher
.
Can be reset via resetOnOperator()
T
- the arbitrary assembled sequence typeonOperator
- a callback for each assembly that must return a non-null Hooks.OperatorHook
public static void onOperatorError(BiFunction<? super Throwable,Object,? extends Throwable> f)
f
- an operator error BiFunction
mapper, returning an arbitrary exception
given the failure and optionally some original context (data or error).public static void resetOnErrorDropped()
public static void resetOnNextDropped()
Exceptions.failWithCancel()
public static void resetOnOperator()
public static void resetOnOperatorError()