2
votes

I am trying to invoke hellow world example Flow through RPC Client. As per the documentation, I have to call startFlowDynamic to invoke the flow. But I am unable to code the startflowdynamic method call.

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

Error log

Error:Error:(48, 14) java: method startFlowDynamic in interface net.corda.core.messaging.CordaRPCOps cannot be applied to given types; required: java.lang.Class>,java.lang.Object[] found: com.template.flows.IOUFlow,java.lang.Integer,net.corda.core.identity.Party reason: cannot infer type-variable(s) T (argument mismatch; com.template.flows.IOUFlow cannot be converted to java.lang.Class>

Please help

1
please add your error log or explain your issuemanish
Integer iouValue=99; CordaX500Name x500Name = CordaX500Name.parse("O=PartyB,L=New York,C=US"); Party otherParty=proxy.wellKnownPartyFromX500Name(x500Name); final IOUFlow I = new IOUFlow(iouValue,otherParty); proxy.startFlowDynamic(I,iouValue,otherParty);Amit Mallick
Error:Error:(48, 14) java: method startFlowDynamic in interface net.corda.core.messaging.CordaRPCOps cannot be applied to given types; required: java.lang.Class<? extends net.corda.core.flows.FlowLogic<? extends T>>,java.lang.Object[] found: com.template.flows.IOUFlow,java.lang.Integer,net.corda.core.identity.Party reason: cannot infer type-variable(s) T (argument mismatch; com.template.flows.IOUFlow cannot be converted to java.lang.Class<? extends net.corda.core.flows.FlowLogic<? extends T>>)Amit Mallick
Where IOUFlow is the name of my Flow Class annotated by @StartableByRPCAmit Mallick

1 Answers

2
votes

The first parameter of the startFlowDynamic method should be a class object of the flow you want to run. Foe example:

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

This exact IOU CorDapp that you are trying to run has a fully implemented spring server at: https://github.com/corda/samples-java/tree/master/Advanced/obligation-cordapp/clients