Kotlin协程观察员

时间:2020-06-02 05:51:53

标签: spring-boot kotlin grpc kotlin-coroutines

我正在用Spring,Kotlin和Coroutines开发GRPC服务器。我的rpc服务如下:

override fun authToken(request: AuthTokenRequest): Flow<AuthTokenResponse> {
    return flow<AuthTokenResponse> {
        while (true) {
            delay(1000)
            emit(AuthTokenResponse.newBuilder().setToken("Hello").build())
        }
    }
}

我想等到其他人更改数据库中的值,连接到服务器等后,在这种情况下,我需要发出新的Response。同时,客户仍然流连忘返。我应该使用什么概念或设计模式?感谢您的答复

0 个答案:

没有答案