Spring WebFlux: Only one connection receive subscriber allowed

后端 未结 3 1233
名媛妹妹
名媛妹妹 2021-01-18 00:42

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.         


        
3条回答
  •  时光说笑
    2021-01-18 01:03

    I've done a very similar example here:

    This router will get a geolocation from name and the with another service extract the sunrise and sunset time:

    I've use the and method from Mono.

    internal fun buildResponse(address: Mono) =
            address.transform(geoLocationService::fromAddress).and(this::sunriseSunset, ::LocationResponse)
    
    internal fun sunriseSunset(geographicCoordinates: GeographicCoordinates) =
            geographicCoordinates.toMono().transform(sunriseSunsetService::fromGeographicCoordinates)
    

    More details of this example

提交回复
热议问题