我要将状态机的策略设置为TIMEOUT_CANCEL

时间:2019-05-08 08:26:19

标签: spring-boot state-machine

我要将状态机的策略设置为TIMEOUT_CANCEL。我在文档中看到一个示例:

Policy can be set to TIMEOUT_CANCEL together with a global timeout per machine. This changes state behaviour to wait action completion before cancel is requested.

@Override
public void configure(StateMachineConfigurationConfigurer<String, String> config) throws Exception {
    config
        .withConfiguration()
            .stateDoActionPolicy(StateDoActionPolicy.TIMEOUT_CANCEL)
            .stateDoActionPolicyTimeout(10, TimeUnit.SECONDS);
}

状态机是通过构建器创建的

@Override
public StateMachineBuilder.Builder<StatusId, ActionId> construct(StateMachineBuilder.Builder<StatusId, ActionId> builder) throws Exception {
    builder
    .configureConfiguration()
    .withConfiguration()
    **.stateDoActionPolicy() //but this method is missing**

    return.builder();
    }

但是缺少stateDoActionPolicy()方法。我不明白如何设置TIMEOUT_CANCEL

0 个答案:

没有答案