Skip to content

Commit

Permalink
Add toString() for the resulting object
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabby Anandan committed Aug 13, 2020
1 parent 9b42bfd commit 38c082f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public Function<KStream<Object, Truck>, KStream<String, AverageBrakeTemperatureA
agg.setCount(agg.getCount() + 1);
agg.setTotalValue(v.getBrakeTemperature());
agg.setAverage(agg.getTotalValue() / agg.getCount());
agg.setId(v.getId());
return agg;
},
Materialized.with(Serdes.String(), new JsonSerde<>(AverageBrakeTemperatureAccumulator.class)))
Expand All @@ -49,6 +50,8 @@ static class AverageBrakeTemperatureAccumulator {

private int count;

private String id;

private Float totalValue;

private double average;
Expand All @@ -73,6 +76,14 @@ public void setCount(int count) {
this.count = count;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public Float getTotalValue() {
return totalValue;
}
Expand Down Expand Up @@ -104,5 +115,13 @@ public Date getEnd() {
public void setEnd(Date end) {
this.end = end;
}

@Override public String toString() {
return "Average Brake Temperature: {" +
"count=" + count +
", id='" + id + '\'' +
", average=" + average +
'}';
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@

spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000

0 comments on commit 38c082f

Please sign in to comment.