The minimal working example below presents some (simplified) processing where:
- each event is processed individually (no windowing),
- each event belongs to a certain group,
- each event updates a group state, which then is used to generate some output value.
public class RollingExample {
public static void main(String[] args) {
JetInstance jet = Jet.newJetInstance();
Pipeline p = Pipeline.create();
p.readFrom(TestSources.itemStream(10))
.withoutTimestamps()
.groupingKey(event -> event.sequence() % 10) //simulates 10 groups
.rollingAggregate(AggregateOperation
.withCreate(DoubleAccumulator::new) //group state simulated by a single double value
.andAccumulate((DoubleAccumulator acc, SimpleEvent event) -> acc.accumulate(event.sequence())) //update group state with given event
.andCombine(DoubleAccumulator::combine)
.andDeduct(DoubleAccumulator::deduct)
.andExportFinish(DoubleAccumulator::export))
.map(x -> x.getKey() + " -> " + x.getValue()) //map group state to some output value
.writeTo(Sinks.logger());
jet.newJob(p).join();
}
}
Given the above example, is it possible to query individual group states from outside, e.g. using Hazelcast Client? By "query" I mean programmatically getting current value of an accumulator for given group.