public class Windows
extends java.lang.Object
Window
implementations.Constructor and Description |
---|
Windows() |
Modifier and Type | Method and Description |
---|---|
static <T,K> Window<T,K,java.util.LinkedList<T>> |
lastNProcessOnInsert(int count,
Function<T,K> keyFunction)
Return a window that maintains the last
count tuples inserted
with processing triggered on every insert. |
static <T,K,L extends java.util.List<T>> |
window(BiFunction<Partition<T,K,L>,T,java.lang.Boolean> insertionPolicy,
BiConsumer<Partition<T,K,L>,T> contentsPolicy,
Consumer<Partition<T,K,L>> evictDeterminer,
BiConsumer<Partition<T,K,L>,T> triggerPolicy,
Function<T,K> keyFunction,
Supplier<L> listSupplier)
Create a window using the passed in policies.
|
public static <T,K,L extends java.util.List<T>> Window<T,K,L> window(BiFunction<Partition<T,K,L>,T,java.lang.Boolean> insertionPolicy, BiConsumer<Partition<T,K,L>,T> contentsPolicy, Consumer<Partition<T,K,L>> evictDeterminer, BiConsumer<Partition<T,K,L>,T> triggerPolicy, Function<T,K> keyFunction, Supplier<L> listSupplier)
T
- Tuple type.K
- Key type.L
- List type.insertionPolicy
- Policy indicating if a tuple should be inserted
into the window.contentsPolicy
- Contents policy called prior to insertion of a tuple.evictDeterminer
- Policy that determines action to take when
Partition.evict()
is called.triggerPolicy
- Trigger policy that is invoked after the insertion
of a tuple into a partition.keyFunction
- Function that gets the partition key from a tuple.listSupplier
- Supplier function for the List
that holds
tuples within a partition.public static <T,K> Window<T,K,java.util.LinkedList<T>> lastNProcessOnInsert(int count, Function<T,K> keyFunction)
count
tuples inserted
with processing triggered on every insert. This provides
a continuous processing, where processing is invoked every
time the window changes. Since insertion drives eviction
there is no need to process on eviction, thus once the window
has reached count
tuples, each insertion results in an
eviction followed by processing of count
tuples
including the tuple just inserted, which is the definition of
the window.T
- Tuple type.K
- Key type.count
- Number of tuple to maintain per partitionkeyFunction
- Tuple partitioning key functioncount
tuples on a streamCopyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641