@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@ package demo.scope;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.statemachine.StateMachine;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import demo.scope.StateMachineConfig.Events;
|
||||
import demo.scope.StateMachineConfig.States;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Controller
|
||||
public class StateMachineController {
|
||||
@@ -44,7 +46,10 @@ public class StateMachineController {
|
||||
@RequestMapping("/states")
|
||||
public String getStates(@RequestParam(value = "event", required = false) Events event, Model model) {
|
||||
if (event != null) {
|
||||
stateMachine.sendEvent(event);
|
||||
stateMachine
|
||||
.sendEvent(Mono.just(MessageBuilder
|
||||
.withPayload(event).build()))
|
||||
.blockLast();
|
||||
}
|
||||
model.addAttribute("states", stateMachine.getState().getIds());
|
||||
model.addAttribute("stateChartModel", stateChartModel);
|
||||
|
||||
Reference in New Issue
Block a user