2017-10-04 14 views
0

hereにあるサンプルプロジェクトを実行しようとしています。ことができ、私はこのコードが書かれていたので、春のAPIが変更されたことを推測している'Mono.and()'は、指定されたパラメータで呼び出すことができません

internal class ApiHandler(val geoLocationService: GeoLocationService, val sunriseSunsetService: SunriseSunsetService, 
         val errorHandler: ErrorHandler) { 

    private companion object { 
     const val ADDRESS = "address" 
    } 

    internal fun getLocation(request: ServerRequest) = 
     request.pathVariable(ADDRESS).toMono() 
       .transform(this::buildResponse) 
       .transform(this::serverResponse) 
       .onErrorResume(errorHandler::throwableError)!! 

    internal fun postLocation(request: ServerRequest) = 
     request.extract<LocationRequest>() 
       .map(LocationRequest::address) 
       .transform(this::buildResponse) 
       .transform(this::serverResponse) 
       .onErrorResume(errorHandler::throwableError)!! 

    internal fun buildResponse(address: Mono<String>) = 
     address.transform(geoLocationService::fromAddress) 
       .and(this::sunriseSunset, ::LocationResponse) 

    internal fun sunriseSunset(geographicCoordinates: GeographicCoordinates) = 
     geographicCoordinates.toMono().transform(sunriseSunsetService::fromGeographicCoordinates) 

    internal fun serverResponse(locationResponseMono: Mono<LocationResponse>): Mono<ServerResponse> = 
     locationResponseMono.flatMap { ok() withBody it } 
} 

、私:しかし、私はbuildResponse機能でApiHandler.ktクラスに

Error:(38, 22) Kotlin: None of the following functions can be called with the arguments supplied: public final fun and(p0: ((Subscriber<in Any!>!) -> Unit)!): Mono<Void!>! defined in reactor.core.publisher.Mono public final fun and(p0: Publisher<*>!): Mono<Void!>! defined in reactor.core.publisher.Mono

を見ています.and(...)に何を変更するかを把握していない。

答えて

1

これは3.1.0のReactor Core APIの変更とリンクしていると思います。

Mono.and()は、もはやタプルを返す演算子ではなくなりましたが、今完了信号を気にするだけです(Mono<Void>)。 and()オペレーターをthe Reactor release notesのようにzipまたはzipWithオペレーターに置き換える必要があります。

関連する問題