【发布时间】:2021-02-17 01:16:23
【问题描述】:
我正在尝试评估来自两个不同服务的 Mono 类型的响应
data class Customer(
val customerId : String ,
val customerBlance : CustomerBalance,
val customername : String ,
val customerRefNo : String
)
data class CustomerBalance(
val totalAmount : Double ,
val totalCreditAmount : Double ,
val totalDebitAmount : Double
)
这里我有两个服务,一个返回客户信息,另一个返回客户余额 都发出 Mono 的对象。
firstService 返回我需要在 CustomerBalance 对象上设置的 Mono。
第二个服务返回我需要在 CustomerBalance 对象上设置的 Mono。
我尝试编写下面的代码能够评估第一个单声道,但在迭代第二个单声道以设置 CustomerBalance 对象时遇到问题。
class CustomerInformationService
{
fun getCustomerInfomation( firstObject:Mono<Any>, second:Mono<Any>):Mono<Customer>
{
second.map { getCustomerInfo(it) }
}
private fun getCustomerInfo(it : Any?):Customer {
return Customer()
}
}
任何帮助将不胜感激。
【问题讨论】:
标签: java kotlin mono reactive-programming spring-webflux