Спасибо за код. Похоже, 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
В качестве альтернативы вы можете просто позвонить send
на Initiator
, есливы не ожидаете ответа от Acceptor
: https://docs.corda.net/api-flows.html#send