2
votes

How to use project reactor backpressure feature with kafka binder in spering cloud stream?

@Bean
public Function<Flux<String>, Flux<String>> processor() {
    return flux -> flux.delayElements(Duration.ofSeconds(1));
}

If I use this way, than publisher send messages with delay of 1 second, but consumer consume messages without any delay.

It is possible to use backperessure on cunsumer with spring cloud stream?

1

1 Answers

1
votes

You can't. Back-pressure implies that the producer of messages (de-queued from broker) is back-pressure aware and in this case it is not. It is relying on inbound channel adapter from Spring Integration framework. To support back pressure there is a need for true reactive API/approach for these message brokers like for example there are some initiatives in RabbitMQ