I am trying to write a client for my server (both in Kotlin and using Spring Reactive Web). I encountered this problem while trying to use the RSocket. How can I get a Flux using RSocket?
@Component class RSocketClient(val rSocketRequester: RSocketRequester) { data class Header(val playerToken: Int) fun matchmake(): Flux<Int> { return rSocketRequester.route("matchmaking") .data(Header(0)) .retrieveFlux(Int) } }
Advertisement
Answer
You need to get reference of Class
. You can use either Int::class.java
or Int::class
depending whether you need java Class
or KClass
reference
@Component class RSocketClient(val rSocketRequester: RSocketRequester) { data class Header(val playerToken: Int) fun matchmake(): Flux<Int> { return rSocketRequester.route("matchmaking") .data(Header(0)) .retrieveFlux(Int::class.java) } }