Kafka Streams to topic

I need to calculate an average with a kafka streams. The producer produce with Avro and so i need to deserialize with it and i receive a GenericRecord with a json String that i have to elaborate.

I use a user defined type as support.

private class Tuple {

public int occ;

public int sum;

public Tuple (int occ, int sum) {

this.occ = occ;

this.sum = sum;

}

public void sum (int toAdd) {

this.sum += toAdd;

this.occ ++;

}

public Double getAverage () {

return new Double (this.sum / this.occ);

}

public String toString() {

return "occorrenze: " + this.occ + ", somma: "...

Read More »

By: StackOverFlow - Tuesday, 20 November

Related Posts