public void start(Request incomingRequest) {
WorkflowInstance instance = new WorkflowInstance();
instance.setSomeMessage(incomingRequest.getMessage());
instance = workflowInstanceRepository.save(instance); //This will generate an UUID which I want to use to get my machine everytime I am coming back and changing the transition
//ID should be taken from the config? or how as each one will have a separate data
StateMachine<States, Events> stateMachine = factory.getStateMachine();
stateMachine.start();
Message<Events> message = MessageBuilder
.withPayload(Events.INITIALIZING)
.setHeader("message", incomingRequest).build();
stateMachine.sendEvent(message);
}
此代码段允许我设置ID为“test”的计算机,但是如果我想在一个环境中工作,我可以在启动它之前根据某些参数使用某些UUID唯一地识别我的每台机器,我怎么能这样做与事件共享相同,以便当它返回时它将启动相同的状态机
public function category($slug) {
$category = Category::select()
->where('slug', $slug)
->with(['webshops' => function ($query) {
$query->groupBy('webshops.id')
->where('active', 1)
->orderBy('webshops.name')
->with(['brands' => function ($query) {
$query->where('active', 1)
->where('replace_by', NULL)
->orderBy('name');
}])
->paginate(3);
}])
->first();
if(!$category)
abort(404);
$data['title'] = "Tøjbutikker der forhandler ". $category->name;
$data['category'] = $category;
$data['webshops'] = $category->webshops;
return view('pages/category', $data);
}
答案 0 :(得分:0)
您不需要在配置中设置机器ID,而是可以使用工厂设置它:
思维工厂不会保留这些机器并且每次都会返回新实例,因为它只允许设置机器ID。
StateMachine<States, Events> stateMachine = factory.getStateMachine("test");
下一个版本1.2.8
将有一些额外的工具来帮助管理正在运行的计算机,因为它看起来就像你想在这里做的那样。