S
- type of message that will be sent by the producersT
- type of message that will be received by the consumersU
- intermerdiary accumulator type used to aggregate the messagespublic interface AggregationPolicy<S,T,U>
SinkModule
defines a AggregationPolicy
, messages
will be aggregated by accumulators, which are keyed based on the object
returned by key(Object)
.
The aggregation function aggregate(Object, Object)
is called to
create accumulators and add messages to existing accumulators.
The completion size and completion interval options determine the conditions
under which the buckets will be dispatched.Modifier and Type | Method and Description |
---|---|
U |
aggregate(U accumulator,
S newMessage)
Aggregate the given message into an existing accumulator, or
create a new accumulator if no accumulator exists.
|
T |
build(U accumulator)
Build the resulting message from the accumulator.
|
int |
getCompletionIntervalMs()
Maximum number of milliseconds for which buckets should
continue accumulating messages after creation.
|
int |
getCompletionSize()
Maximum number of messages to be added to a bucket before dispatching.
|
Object |
key(S message)
Calculate a key for the given message.
|
int getCompletionSize()
int getCompletionIntervalMs()
Object key(S message)
message
- the messageU aggregate(U accumulator, S newMessage)
accumulator
- the existing accumulator, or null
if a new accumulator should be creatednewMessage
- the message to aggregateCopyright © 2020. All rights reserved.