如何重新启动或停止/恢复响应式消息传递,例如在更改间隔时间之后?此示例来自 Quarkus 指南:https ://quarkus.io/guides/kafka-streams
@Outgoing("temperature-values")
public Flowable<KafkaRecord<Integer, String>> generate() {
return Flowable.interval(500, TimeUnit.MILLISECONDS)
.onBackpressureDrop()
.map(tick -> {
WeatherStation station = stations.get(random.nextInt(stations.size()));
double temperature = BigDecimal.valueOf(random.nextGaussian() * 15 + station.averageTemperature)
.setScale(1, RoundingMode.HALF_UP)
.doubleValue();
LOG.infov("station: {0}, temperature: {1}", station.name, temperature);
return KafkaRecord.of(station.id, Instant.now() + ";" + temperature);
});
}