【问题标题】:RPC Client to invoke flow in cordaRPC客户端在corda中调用流
【发布时间】:2020-05-28 04:15:13
【问题描述】:

我正在尝试通过 RPC 客户端调用地狱世界示例流。根据文档,我必须调用 startFlowDynamic 来调用流程。但我无法编写 startflowdynamic 方法调用。

Integer iouValue=99;
Party otherParty= nameornull("O=PartyB,L=New York,C=US");
proxy.startFlowDynamic(com.template.IOUFlow,iouValue,otherParty);
logger.info("{}", nodes);

错误日志

Error:Error:(48, 14) java: 接口 net.corda.core.messaging.CordaRPCOps 中的方法 startFlowDynamic 不能应用于给定类型;必需:java.lang.Class>,java.lang.Object[] 找到:com.template.flows.IOUFlow,java.lang.Integer,net.corda.core.identity.Party 原因:无法推断类型变量(s ) T (参数不匹配;com.template.flows.IOUFlow不能转换成java.lang.Class>

请帮忙

【问题讨论】:

  • 请添加您的错误日志或解释您的问题
  • 整数 iouValue=99; CordaX500Name x500Name = CordaX500Name.parse("O=PartyB,L=New York,C=US");方 otherParty=proxy.wellKnownPartyFromX500Name(x500Name);最终 IOUFlow I = new IOUFlow(iouValue,otherParty); proxy.startFlowDynamic(I,iouValue,otherParty);
  • Error:Error:(48, 14) java: 接口 net.corda.core.messaging.CordaRPCOps 中的方法 startFlowDynamic 不能应用于给定类型;必需:java.lang.Class>,java.lang.Object[] found: com.template.flows.IOUFlow,java.lang.Integer,net.corda.core.identity.Party 原因:无法推断类型变量 T(参数不匹配;com.template.flows.IOUFlow 无法转换为 java.lang.Class extends net.corda.core.flows.FlowLogic extends T>>)
  • 其中 IOUFlow 是我的流类的名称,由 @StartableByRPC 注释

标签: corda


【解决方案1】:

startFlowDynamic 方法的第一个参数应该是您要运行的流程的类对象。敌人示例:

SignedTransaction result = proxy.startTrackedFlowDynamic(IOUIssueFlow.InitiatorFlow.class, state).getReturnValue().get();

您尝试运行的这个确切的 IOU CorDapp 有一个完全实现的 spring 服务器:https://github.com/corda/samples-java/tree/master/Advanced/obligation-cordapp/clients

【讨论】:

    猜你喜欢
    • 2020-11-16
    • 1970-01-01
    • 2018-12-19
    • 1970-01-01
    • 2019-06-18
    • 1970-01-01
    • 2016-10-13
    • 1970-01-01
    • 2020-03-28
    相关资源
    最近更新 更多