T
- Tuple type.K
- Key type.public class PressureReliever<T,K> extends Pipe<T,T>
A window partition is maintained for each key seen on the input stream. Any tuple arriving on the input stream is inserted into the window. Asynchronously tuples are taken from the window using FIFO and submitted downstream. The submission of tuples maintains order within a partition but not across partitions.
Tuples are discarded and not submitted to the output port if the downstream processing cannot keep up the incoming tuple rate.
count
PressureReliever
up to last (most recent) N
tuples
are maintained in a window partition.
Insertion of the oplet into a stream disconnects the
upstream processing from the downstream processing,
so that downstream processing is executed on a different
thread to the thread that processed the input tuple.
Constructor and Description |
---|
PressureReliever(int count,
Function<T,K> keyFunction)
Pressure reliever that maintains up to
count most recent tuples per key. |
Modifier and Type | Method and Description |
---|---|
void |
accept(T tuple)
Apply the function to
value . |
void |
close() |
void |
initialize(OpletContext<T,T> context)
Initialize the oplet.
|
getDestination, getInputs, start, submit
getOpletContext
public void initialize(OpletContext<T,T> context)
Oplet
initialize
in interface Oplet<T,T>
initialize
in class Pipe<T,T>
public void accept(T tuple)
Consumer
value
.tuple
- Value function is applied to.public void close() throws java.lang.Exception
java.lang.Exception
Copyright IBM 2015,2016 - 2f6ad0e-20160307-0902