class Initiator(private val notificationObject: NotificationModel, private val counterParty: Party) : FlowLogic<Unit>() {
        @Suspendable
        override fun call() {
            val counterPartySession = initiateFlow(counterParty)
            val counterPartyData = counterPartySession.sendAndReceive<NotificationModel>(notificationObject)
            counterPartyData.unwrap { msg ->
                assert(msg.notification_data == notificationObject.notification_data)
            }
        }
    }sendAndReceive出了点问题。任何形式的帮助都是值得感谢的。
发布于 2019-10-31 18:32:37
谢谢你的代码。看起来Acceptor没有向Initiator发回消息
您的Initiator调用sendAndReceive<>,这意味着它想要从Acceptor获取一些东西。在本例中,Acceptor没有发回响应,所以我们看到了UnexpectedEndOfFLowException (因为Initiator期望得到一些东西,但是没有得到)。
我怀疑您可能想要添加一行代码来将NotificationModel发回:
@InitiatedBy(Initiator::class)
class Acceptor(private val counterpartySession: FlowSession) : FlowLogic<Unit>() { 
    @Suspendable override fun call() { 
        val counterPartyData = counterpartySession.receive<NotificationModel>() 
        counterPartyData.unwrap { msg -> //code goes here } 
        counterPartySession.send(/* some payload of type NotificationModel here */)
    } 
}请参阅以下文档:https://docs.corda.net/api-flows.html#sendandreceive
或者,如果您不期望从Acceptor:https://docs.corda.net/api-flows.html#send返回响应,可以只在Initiator上调用Acceptor
https://stackoverflow.com/questions/58639296
复制相似问题