16 lines
539 B
Kotlin
16 lines
539 B
Kotlin
|
package com.cubetiqs.wsclient
|
||
|
|
||
|
import org.springframework.web.reactive.function.client.WebClient
|
||
|
import reactor.core.publisher.Flux
|
||
|
|
||
|
class WebClientStockClient(val webClient: WebClient) : StockClient {
|
||
|
override fun priceFor(symbol: String): Flux<StockPrice> {
|
||
|
return webClient.get()
|
||
|
.uri("http://localhost:8080/stocks/{symbol}", symbol)
|
||
|
.retrieve()
|
||
|
.bodyToFlux(StockPrice::class.java)
|
||
|
.doOnError {
|
||
|
println(it.message)
|
||
|
}
|
||
|
}
|
||
|
}
|