spring-cloud-function icon indicating copy to clipboard operation
spring-cloud-function copied to clipboard

Consumer (Reactive) add Mono support

Open k631583871 opened this issue 3 years ago • 3 comments
trafficstars

add Consumer (Reactive) Each message generates a Mono. When an error occurs in a single message, it can also be processed and entered into dlq correctly

public Function<Mono<?>, Mono<Void>>consumer() {
	return mono -> mono.map(..).filter(..).then();
}

k631583871 avatar Apr 10 '22 14:04 k631583871

I'm not a part of the team so I may be wrong, but from what I've understood I'd recommend not to use Reactive Spring Cloud Stream until the Reactor Kafka (or any other reactive source) will be released. I'd recommend in general to make sure that your source is reactive/async when you using Reactor. See this issue to track Reactor Kafka support in Spring Cloud Stream. https://github.com/spring-cloud/spring-cloud-stream/issues/2293

devlap2 avatar Apr 10 '22 21:04 devlap2

I do agree with @devlap2 . While we provide support for reactive API, it is just that - the API support, but no back pressure or other features that specifically ask for reactive support and as @devlap2 pointed out it is because our sources and targets are not reactive themselves. In other words behind the scene it is still a conventional MessageListener sending messages to a stream

olegz avatar Apr 22 '22 10:04 olegz

That said, i don't mind adding such support, although I believe it will be transferred to s-c-function. Let me see and I'll transfer it.

olegz avatar Apr 22 '22 10:04 olegz