This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val clientConnection = client.start(rpcUsername, rpcPassword) | |
val proxy = clientConnection.proxy | |
val nodes = proxy.networkMapSnapshot() | |
val partyA = getNodeWithName(nodes,"PartyA", "O=PartyA, L=London, C=GB") | |
val partyB = getNodeWithName(nodes,"PartyB", "O=PartyB, L=New York, C=US") | |
// Instead of searching for accounts owned by PartyA you can simply pass the PaymentAccountId to the MakePayment flow | |
val accountA = proxy.startTrackedFlow( | |
::PaymentAccounts, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bing! 0! | |
Bong! 0! | |
Bing! 1! | |
Bong! 1! | |
Bing! 2! | |
Bong! 2! | |
Bing! 3! | |
Bong! 3! | |
Bing! 4! | |
Bong! 4! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bing! 0! | |
Bing! 1! | |
Bing! 2! | |
Bing! 3! | |
Bing! 4! | |
Bing! 5! | |
Bong! 0! | |
Bong! 1! | |
Bong! 2! | |
Bong! 3! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void wakeyFlowTest() { | |
WakeyFlow flow1 = new WakeyFlow("Bing!", 5); | |
WakeyFlow flow2 = new WakeyFlow("Bong!", 5); | |
CordaFuture<Void> futureA = nodeA.startFlow(flow1); | |
CordaFuture<Void> futureB = nodeB.startFlow(flow2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void sleepyFlowTest() { | |
SleepyFlow flow1 = new SleepyFlow("Bing!", 5, 500L); | |
SleepyFlow flow2 = new SleepyFlow("Bong!", 5, 500L); | |
CordaFuture<Void> futureA = nodeA.startFlow(flow1); | |
CordaFuture<Void> futureB = nodeA.startFlow(flow2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Suspendable | |
@Override | |
public Void call() throws FlowException{ | |
for (int i = 0; i < limit; i++){ | |
System.out.println(message + " " + i + "!"); | |
try { | |
FlowLogic.sleep(Duration.ofMillis(sleepTime)); | |
} catch (Exception e) { | |
System.out.println(e); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Suspendable | |
@Override | |
public Void call() throws FlowException{ | |
for (int i = 0; i < limit; i++){ | |
System.out.println(message + " " + i + "!"); | |
} | |
return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@CordaService | |
public class ShipOrderService extends SingletonSerializeAsToken { | |
private final AppServiceHub serviceHub; | |
public ShipOrderService(AppServiceHub serviceHub) { | |
this.serviceHub = serviceHub; | |
directShipment(); | |
} | |
private void directShipment() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public SignedTransaction call() throws FlowException { | |
// some code ... | |
// calling Corda Services | |
ShipOrderService service = getServiceHub().cordaService(ShipOrderService.class); | |
// more code ... | |
} |