有没有办法通知一方流程已经完成?
Is there a way that a Party can be notified that a Flow has been completed?
以Corda文档(参见here)中描述的流程为例,Bob如何在不轮询自己的vault的情况下收到他刚刚签署的交易已完成的通知?
是否存在特定回调?
我需要 Bob 节点上的 CorDapp 运行 与另一个系统实时通信交易状态
非常感谢
实现此目的的两种方法:
1.使用 Client
订阅更新
cordaRPCOPS.vaultTrack(<YourState>.class).getUpdates().subscribe( update -> {
update.getProduced().forEach(stateAndRef -> {
// Action to be Performed on State Update
});
});
2。使用 CordaService 订阅更新:
getServiceHub().getVaultService().trackBy(<YourState>.class).getUpdates().subscribe( update -> {
update.getProduced().forEach(stateAndRef -> {
// Action to be Performed on State Update
});
});
除了 Ashutosh 的回答,
在识别 API 启动流程的 SpringBoot 网络服务器中,您可以使用 proxy.startTrackedFlowDynamic()
(其中 proxy
是节点的 RPC 连接);它 returns 一个 FlowProgressHandle
可以用来订阅流事件。
以Corda文档(参见here)中描述的流程为例,Bob如何在不轮询自己的vault的情况下收到他刚刚签署的交易已完成的通知? 是否存在特定回调?
我需要 Bob 节点上的 CorDapp 运行 与另一个系统实时通信交易状态
非常感谢
实现此目的的两种方法:
1.使用 Client
订阅更新cordaRPCOPS.vaultTrack(<YourState>.class).getUpdates().subscribe( update -> {
update.getProduced().forEach(stateAndRef -> {
// Action to be Performed on State Update
});
});
2。使用 CordaService 订阅更新:
getServiceHub().getVaultService().trackBy(<YourState>.class).getUpdates().subscribe( update -> {
update.getProduced().forEach(stateAndRef -> {
// Action to be Performed on State Update
});
});
除了 Ashutosh 的回答,
在识别 API 启动流程的 SpringBoot 网络服务器中,您可以使用 proxy.startTrackedFlowDynamic()
(其中 proxy
是节点的 RPC 连接);它 returns 一个 FlowProgressHandle
可以用来订阅流事件。