如何根据信号更改节奏工作流程中的睡眠持续时间?这是使用java客户端的正确方法吗?
private int timeout;
@Override
@WorkflowMethod
public void sleepAndWakeUp(int sleepTimeout) {
this.timeout = sleepTimeout;
sleep();
System.out.println("Woken up after " + this.timeout + " s sleep");
}
private void sleep() {
int currentTimeout = this.timeout;
Workflow.await(Duration.ofSeconds(this.timeout), () -> {
boolean cancelTimer = currentTimeout != this.timeout;
if(cancelTimer) {
sleep();
}
return cancelTimer;
});
}
@Override
@SignalMethod
public void snooze(int sleepTimeout) {
this.timeout = sleepTimeout;
}
我还没有找到取消和重新安排工作流睡眠计时器的其他可能性