reactor-netty

Spring WebFlux: Only one connection receive subscriber allowed

拟墨画扇 提交于 2019-12-01 20:24:21
I am writing a simple app with Spring 5 Webflux and Kotlin. I am trying to implement PUT endpoint in a following way: PUT("/confs/{id}", { val id = it.pathVariable("id") ServerResponse.ok().body(service.save(it.bodyToMono(Item::class.java)), Item::class.java) }) The trick on save is that I try to read a city name from item, resolve geo coordinates, overwrite them in original item and then save to Mongo using Spring Data Mongo Reactive repo. fun save(item: Mono<Item>): Mono<Item> { val geo = item.flatMap { val city = it.location?.city ?: "Somewhere" geoService.resolveGeoFromCity(city) } val

How to execute blocking calls within a Spring Webflux / Reactor Netty web application

半世苍凉 提交于 2019-11-30 15:34:31
问题 In my use case where I have a Spring Webflux microservice with Reactor Netty, I have the following dependencies: org.springframework.boot.spring-boot-starter-webflux (2.0.1.RELEASE) org.springframework.boot.spring-boot-starter-data-mongodb-reactive (2.0.1.RELEASE) org.projectreactor.reactor-spring (1.0.1.RELEASE) For a very specific case I need to retrieve some information from my Mongo database, and process this into query parameters send with my reactive WebClient . As the WebClient nor the

How to execute blocking calls within a Spring Webflux / Reactor Netty web application

偶尔善良 提交于 2019-11-30 14:17:34
In my use case where I have a Spring Webflux microservice with Reactor Netty, I have the following dependencies: org.springframework.boot.spring-boot-starter-webflux (2.0.1.RELEASE) org.springframework.boot.spring-boot-starter-data-mongodb-reactive (2.0.1.RELEASE) org.projectreactor.reactor-spring (1.0.1.RELEASE) For a very specific case I need to retrieve some information from my Mongo database, and process this into query parameters send with my reactive WebClient . As the WebClient nor the UriComponentsBuilder accepts a Publisher (Mono / Flux) I used a #block() call to receive the results.