S
- type of the state objectT
- type of the items the sink will acceptpublic final class AssertionSinkBuilder<S,T> extends Object
Modifier and Type | Method and Description |
---|---|
static <S> AssertionSinkBuilder<S,Void> |
assertionSink(String name,
SupplierEx<? extends S> createFn)
Returns a builder object that offers a step-by-step fluent API to build
an assertion
Sink for the Pipeline API. |
Sink<T> |
build()
Creates and returns the
Sink with the components you supplied to
this builder. |
AssertionSinkBuilder<S,T> |
completeFn(ConsumerEx<? super S> completeFn)
Sets the function that will be called after all the upstream stages have
completed and all the items were received.
|
<T_NEW> AssertionSinkBuilder<S,T_NEW> |
receiveFn(BiConsumerEx<? super S,? super T_NEW> receiveFn)
Sets the function Jet will call upon receiving every item.
|
AssertionSinkBuilder<S,T> |
timerFn(ConsumerEx<? super S> timerFn)
Sets the function that will be called periodically.
|
@Nonnull public static <S> AssertionSinkBuilder<S,Void> assertionSink(@Nonnull String name, @Nonnull SupplierEx<? extends S> createFn)
Sink
for the Pipeline API. An assertion sink is
typically used for testing of pipelines where you want to run
an assertion either on each item as they arrive, or when all items have been
received.
These are the callback functions you can provide to implement the sink's behavior:
createFn
creates the state which can be used to hold incoming
items.
receiveFn
gets notified of each item the sink receives
and can either assert the item directly or add it to the state
object.
timerFn
is run periodically even when there are no items
received. This can be used to assert that certain assertions have
been reached within a specific time in streaming pipelines.
completeFn
is run after all the items have been received.
This only applies to batch jobs, in a streaming job this method will
never be called.
The sink doesn't participate in the fault-tolerance protocol, which means you can't remember which items you already received across a job restart.
S
- type of the state object@Nonnull public <T_NEW> AssertionSinkBuilder<S,T_NEW> receiveFn(@Nonnull BiConsumerEx<? super S,? super T_NEW> receiveFn)
createFn
and the received item. It may assert the item
directly or push it to the state object.T_NEW
- type of the items the sink will acceptreceiveFn
- the function to execute upon receiving an item@Nonnull public AssertionSinkBuilder<S,T> timerFn(@Nonnull ConsumerEx<? super S> timerFn)
This function is optional.
timerFn
- the optional "timer" function@Nonnull public AssertionSinkBuilder<S,T> completeFn(@Nonnull ConsumerEx<? super S> completeFn)
This function is optional.
completeFn
- the optional "complete" functionCopyright © 2023 Hazelcast, Inc.. All rights reserved.