Refactor region handling and persistence
- Make kryo in AbstractKryoStateMachineSerialisationService aware of same classloader most likely use in an app. This takes away some of those weird kryo errors you see with a web apps. - Add context references concept to StateMachineContext which can be used to store reference id and then individual running machines with regions can independently store their states. Whole machine state can then get restored more accurately. - Add new `region(String id)` to StateConfigurer which can be used to set region id. This is equivalent as setting region id with json based machine structure where you need to define region id's with orthogonal regions are in use. - Add new datajpamultipersist sample showing running regions and how those are persisted to a database. - Fixes #617 - Fixes #605 - Fixes #615
This commit is contained in:
@@ -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.
|
||||
@@ -120,6 +120,13 @@ public class PersistStateMachineHandler extends LifecycleObjectSupport {
|
||||
Transition<String, String> transition, StateMachine<String, String> stateMachine) {
|
||||
listeners.onPersist(state, message, transition, stateMachine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preStateChange(State<String, String> state, Message<String> message,
|
||||
Transition<String, String> transition, StateMachine<String, String> stateMachine,
|
||||
StateMachine<String, String> rootStateMachine) {
|
||||
listeners.onPersist(state, message, transition, stateMachine);
|
||||
}
|
||||
}
|
||||
|
||||
private class CompositePersistStateChangeListener extends AbstractCompositeListener<PersistStateChangeListener> implements
|
||||
|
||||
@@ -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.
|
||||
@@ -878,6 +878,13 @@ public class TasksHandler {
|
||||
throw new StateMachineException("Error persisting", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preStateChange(State<String, String> state, Message<String> message,
|
||||
Transition<String, String> transition, StateMachine<String, String> stateMachine,
|
||||
StateMachine<String, String> rootStateMachine) {
|
||||
preStateChange(state, message, transition, stateMachine);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user