WorkflowRuntime实现
WorkflowRuntime的代码实现
WorkflowRuntime 简单封装了 durabletask 的 DurableTaskGrpcWorker:
import com.microsoft.durabletask.DurableTaskGrpcWorker;
public class WorkflowRuntime implements AutoCloseable {
private DurableTaskGrpcWorker worker;
public WorkflowRuntime(DurableTaskGrpcWorker worker) {
this.worker = worker;
}
......
}
然后将 start() 和 close() 方法简单的代理给 durabletask 的 DurableTaskGrpcWorker:
public void start() {
this.start(true);
}
public void start(boolean block) {
if (block) {
this.worker.startAndBlock();
} else {
this.worker.start();
}
}
public void close() {
if (this.worker != null) {
this.worker.close();
this.worker = null;
}
}