问题描述
在Corda中,我想创建一个不同版本的响应器流,每个版本供不同的节点使用。
In Corda, I want to create several different versions of a responder flow, each to be used by a different node.
为此,我知道需要在单独的CorDapp中定义每个响应者流程。但是,它们都还需要通过 InitiatedBy
批注依赖于启动流类。
To do so, I understand that I need to define each responder flow in a separate CorDapp. However, they also all need to depend on the initiating flow class via the InitiatedBy
annotation.
如何构造是否在CorDapps中包含响应程序流的不同实现,以便它们都依赖于此公用的启动流,而不将所有响应程序流都包含在我定义了启动流的同一CorDapp中?
How can I structure the CorDapps containing the different implementations of the responder flow so that they all depend on this common initiating flow, without including all the responder flows in the same CorDapp where I defined the initiating flow?
推荐答案
好吧,问题来了,
我认为以下是项目结构,实施:
例如。我有三个PartyA,PartyB,PartyC,每个都有自己的CorDapp版本。
Ex. I have three parties PartyA, PartyB, PartyC and each has their own version of CorDapp's.
-
cordapp-contract-状态-此CorDapp包含共享的
合同
,状态
和抽象启动流
将由交易对手
实施其响应者流逻辑
。 此CorDapp与所有必需的交易对手共享。
cordapp-contract-states - this CorDapp contains shared
contract
,states
, andabstract initiating flows
will be used bycounter-parties
to implement theirresponder flow logic
. This CorDapp shared with all required counterparties.
@InitiatingFlow
抽象类CreateTradeBaseFlow:FlowLogic {
@InitiatingFlowabstract class CreateTradeBaseFlow : FlowLogic {
}
cordapp-partyA -此CorDapp包含 FlowLogic
创建贸易的实现。
cordapp-partyA - this CorDapp contains FlowLogic
implementation for create trade.
@StartableByRPC
类CreateTradeFlow:CreateTradeBaseFlow {
/ /发起方流程的实际实现在这里...
}
cordapp- partyB -此CorDapp包含 CreateTradeFlow
的响应者流以及其他特定于业务的流程逻辑实现。
cordapp-partyB - this CorDapp contain responder flow for CreateTradeFlow
and other business specific flowlogic implementation.
@InitiatedBy(CreateTradeBaseFlow :: class)
类ResponderPartyB(private val otherSideSession:FlowSession):FlowLogic< SignedTransaction>(){
//响应者流的实现在这里...
}
cordapp-partyC -此CorDapp包含响应者流用于 CreateTradeFlow
和其他特定于业务的流逻辑实现。
cordapp-partyC - this CorDapp contain responder flow for CreateTradeFlow
and other business specific flowlogic implementation.
@InitiatedBy(CreateTradeBaseFlow :: class )
类ResponderPartyC(private val otherSideSession:FlowSession):FlowLogic< SignedTransaction>(){
//响应者流的实现在这里...
}
您的想法是什么?
这篇关于如何定义多个响应者流程,每个都在不同的CorDapp中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!