public class ArrayListAggregationPolicy<S> extends Object implements AggregationPolicy<S,List<S>>
ArrayList
aggregates.Constructor and Description |
---|
ArrayListAggregationPolicy(int completionSize,
int completionInterval,
java.util.function.Function<S,Object> keyMapper) |
Modifier and Type | Method and Description |
---|---|
List<S> |
aggregate(List<S> oldBucket,
S newMessage)
Aggregate the given message into an existing bucket, or
create a new bucket if no bucket exists.
|
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.
|
public ArrayListAggregationPolicy(int completionSize, int completionInterval, java.util.function.Function<S,Object> keyMapper)
public Object key(S message)
AggregationPolicy
key
in interface AggregationPolicy<S,List<S>>
message
- the messagepublic List<S> aggregate(List<S> oldBucket, S newMessage)
AggregationPolicy
aggregate
in interface AggregationPolicy<S,List<S>>
oldBucket
- the existing bucket, or null
if a new bucket should be creatednewMessage
- the message to aggregatepublic int getCompletionSize()
AggregationPolicy
getCompletionSize
in interface AggregationPolicy<S,List<S>>
public int getCompletionIntervalMs()
AggregationPolicy
getCompletionIntervalMs
in interface AggregationPolicy<S,List<S>>
Copyright © 2017. All rights reserved.