How to calculate the average of a Project Reactor Flux?

前端 未结 2 576
小蘑菇
小蘑菇 2021-01-29 03:43

I have a method that returns a Flux, let\'s suppose SensorData has a field measure: Integer.

I would like to calculate the av

2条回答
  •  臣服心动
    2021-01-29 03:57

    Mono average = sensorFlux.collect(Collectors.averagingInt(SensorData::getMeasure))
    

提交回复
热议问题