Why isn't the actionFunction working properly?
`.actionFunction(context -> { Flux<String> businessFlux = Flux.just("A", "B", "C") .delayElements(Duration.ofMillis(1000)) .map(item -> { if ("B".equals(item)) { RuntimeException err = new RuntimeException("test one error");
throw err;
}
return item;
});
return businessFlux.then();
})`
The result of stateMachine.sendEvent is always ACCEPTED. Why is this happening and how can I handle it?
Changing the code to the following method still fails to intercept the state changes of the state machine through exceptions.
`.actionFunction(context -> {
return Mono.just("")
// 切换到弹性线程池执行阻塞操作
.subscribeOn(Schedulers.boundedElastic())
.flatMap(__ -> {
try {
List<String> results = Flux.just("A", "B", "C")
.delayElements(Duration.ofMillis(1000))
.map(item -> {
if ("B".equals(item)) {
throw new RuntimeException("test one error");
}
return item;
})
.collectList()
.block();
return Mono.empty();
} catch (Exception e) {
return Mono.error(e);
}
});
})`