Corda节点能否启动与自身的流会话?
在Corda流程中,您可以启动与交易对手的Corda节点能否启动与自身的流会话?,corda,Corda,在Corda流程中,您可以启动与交易对手的流程会话,以发送和接收数据 节点是否可以自己启动流会话?是的,这完全可以。例如,以下方法可行: @InitiatingFlow @StartableByRPC class Initiator : FlowLogic<Unit>() { override val progressTracker = ProgressTracker() @Suspendable override fun call() {
流程会话
,以发送和接收数据
节点是否可以自己启动
流会话?是的,这完全可以。例如,以下方法可行:
@InitiatingFlow
@StartableByRPC
class Initiator : FlowLogic<Unit>() {
override val progressTracker = ProgressTracker()
@Suspendable
override fun call() {
val selfSession = initiateFlow(ourIdentity)
selfSession.send("It's me!")
}
}
@InitiatedBy(Initiator::class)
class Responder(val counterpartySession: FlowSession) : FlowLogic<Unit>() {
@Suspendable
override fun call() {
logger.info(counterpartySession.receive<String>().unwrap { it })
}
}
@InitiatingFlow
@星表
类启动器:FlowLogic(){
重写val progressTracker=progressTracker()
@暂停
覆盖有趣的调用(){
val selfSession=initiateFlow(用户身份)
selfSession.send(“是我!”)
}
}
@发起人(发起人::类)
类响应程序(val countpartysession:FlowSession):FlowLogic(){
@暂停
覆盖有趣的调用(){
info(counterpartySession.receive().unwrap{it})
}
}
是的,这完全没问题。例如,以下方法可行:
@InitiatingFlow
@StartableByRPC
class Initiator : FlowLogic<Unit>() {
override val progressTracker = ProgressTracker()
@Suspendable
override fun call() {
val selfSession = initiateFlow(ourIdentity)
selfSession.send("It's me!")
}
}
@InitiatedBy(Initiator::class)
class Responder(val counterpartySession: FlowSession) : FlowLogic<Unit>() {
@Suspendable
override fun call() {
logger.info(counterpartySession.receive<String>().unwrap { it })
}
}
@InitiatingFlow
@星表
类启动器:FlowLogic(){
重写val progressTracker=progressTracker()
@暂停
覆盖有趣的调用(){
val selfSession=initiateFlow(用户身份)
selfSession.send(“是我!”)
}
}
@发起人(发起人::类)
类响应程序(val countpartysession:FlowSession):FlowLogic(){
@暂停
覆盖有趣的调用(){
info(counterpartySession.receive().unwrap{it})
}
}
自Corda 4以来,这将引发异常,并显示以下消息:
不要为本地节点提供流会话。FinalityFlow将在本地记录经过公证的交易
由于Corda 4,这将引发异常,并显示以下消息:
不要为本地节点提供流会话。FinalityFlow将在本地记录经过公证的交易