Commit Graph

43 Commits

Author SHA1 Message Date
Janne Valkealahti
341d57e48f Add api sugar for mono gets mono
- While this doesn't change underlying behaviour, add sendEventCollect
  method which takes a mono and returns a mono as list of results.
- Add some notes to docs why this is like this, aka having regions
  returns multiple results.
- Fixes #922
2021-03-13 15:48:49 +00:00
Janne Valkealahti
89afd543f4 Port core tests to assertj 2020-11-28 17:51:15 +00:00
Janne Valkealahti
c4f9d68870 Port zookeeper tests to assertj 2020-11-28 14:49:50 +00:00
Janne Valkealahti
2eebb2b0bf Polish build 2019-12-25 09:23:49 +00:00
Janne Valkealahti
da9c68f4e6 Remove TaskExecutor and TaskScheduler
- As all execution and scheduling is now in reactor,
  remove all traces of these spring interfaces.
- Fixes #800
2019-08-03 14:40:37 +01:00
Ming Deng
9f10700da2 Refactor to junit5
- remove junit4 dependecies
- refactor the unit tests by junit5
- enhance the spring-statemachine-test and spring-statemachine-build-tests so they can work together with junit4/junit5
- relates #779
2019-06-08 07:23:59 +01:00
Janne Valkealahti
52fc9c8568 Initial reactive refactor
- Change to Boot 2.2.x to pick upcoming series.
- Introduce Awaitility to tests
- Introduce new StateMachineEventResult concept in favor of boolean
  when sending events. This result interface will have richer information
  what happens when event is processed as previously we simply had boolean
  flag telling if even was accepted. With StateMachineEventResult we can
  can provide more information like if event was deferred and which region
  provided this message.
- Deprecate old event methods and add new reactive event methods which now
  return a Flux of StateMachineEventResult's. This concept then allows
  to send Flux of events to a machine.
- State exit/entry now return Mono<Void>
- Refactor component lifecycle to be reactive as old start/stop would
  not work anymore in a reactive statemachine simply because start may
  cause changes and execute flow's.
- To ease testing add internal assertj assertions for some classes. This
  work is kept in a test classes for time being to get move to public
  spring-statemachine-test when things are more mature.
- Overhaul StateMachineExecutor interface and replace DefaultStateMachineExecutor
  with ReactiveStateMachineExecutor.
- New ReactiveLifecycleManager which is kinda reactive replacement of some internals
  of a LifecycleObjectSupport. Needed as components are reactively started and
  stopped during a machine execution.
- New RegionExecutionPolicy concept which is an attempt to introduce parallel config
  idea to a regions. Previously this was just naively handled with TaskExecutor which
  never worked perfectly while working through reactor now seem to provide more
  consistent results.
- Some test has been changed to reflect changes in a StateMachineExecutor. Also execution
  using reactor made some changes to state notifications which now seem to be
  more consistent(aka. previously parallel execution might have given notifications
  in wrong order and in some cases kinda bogus changes).
- New turnstile reactive sample which is just start of a reactive sample to show
  concept with webflux.
- Don't yet really add any docs as things are in-flight.
- Fixes #740
2019-05-04 16:31:08 +01:00
Spring Operator
426fa163b2 URL Cleanup
- Merge/squash #686 and #694
2019-05-03 15:01:31 +01:00
Janne Valkealahti
168f6476f9 Adapt to logging changes
- Moving over to log4j2 for test logging.
- Need to follow what happens to commons-logging
  per SPR-14512.
- Relates to #394
2017-04-19 15:12:22 +01:00
Janne Valkealahti
def0fce98c Use spring-integration-zookeeper
- In favour of deprecater spring-cloud-cluster
- Fixe some zookeeper deprecation issues
- Fixes #345
2017-04-11 20:20:53 +01:00
Janne Valkealahti
6cce27e30b Add distibuted action
- New module spring-statemachine-cluster which is
  based on spring-cloud-cluster to provide leader
  election.
- Ensemble now has a concept of a leader if implementation
  supports it.
- New DistributedLeaderAction can use leader info to execute
  action only on a leader.
- Tweak web sample with these new concepts.
- Fixes #176
2016-03-28 10:44:48 +01:00
Janne Valkealahti
1bf65760d5 Allow user to use machine id
- change original id to uuid.
- This new id is now for user disposal.
- Currently only meant for a top-level machine.
- Can be set via annotation config, model classes or via
  new StateMachineFactory.getStateMachine(String).
- Is persisted with DefaultStateMachinePersister and
  StateMachineContext.
- Related new tests in ConfigurationTests and StateMachinePersistTests3.
- Fixes #186
2016-03-24 07:54:36 +00:00
Janne Valkealahti
05d4cf05f1 Fix zk ensemble join and start
- Now checking during a start if curator client is
  already started, if so handle join manually. Also
  trying to start client manually.
- Fixes #187
2016-03-20 14:04:28 +00:00
Janne Valkealahti
6282ef7932 Fix possible event miss in zk dist machine
- Add condition to check if we're behind
  for notify events.
- Fixes #152
2016-01-15 12:40:46 +00:00
Janne Valkealahti
3e322e4d00 Add redis persisting support
- Add new StateMachineContextRepository interface.
- Add new redis module having persisting support
  for StateMachineContext.
- Extract kryo serializers into a new kryo module which
  is then shared with zookeeper and redis modules.
- We'll add redis related tests later when we figure out
  a correct pattern for integration tests.
- Fixes #110
2015-12-20 15:44:15 +00:00
Janne Valkealahti
8aaf66afea Fix machine autostart with annotation config
- This seem to relate with machine build from an annotation
  config which is then used as a session scoped bean.
- Fix autostart usage where appropriate and also fix some
  test which were using wrong logic to determine autostart
  usage(tests were wrong).
- Fixes #141
2015-12-12 20:05:43 +00:00
Janne Valkealahti
c981c5a6ee Update docs
- Remove most of a static class modifiers from docs
  to make things easier if doing copy/paste. Not
  all can be removed because some spring inner
  config classes has to be static.
- Fixes #123
2015-11-26 09:36:47 +00:00
Krumlauf, Michael
671e37ce25 Rename EnsembleListeger to EnsembleListener 2015-09-07 16:19:08 -04:00
Janne Valkealahti
b90382575c Move StateMachinePersist up to parent package 2015-08-28 09:15:08 +01:00
Janne Valkealahti
5879332f9f More docs for dist machine 2015-08-23 09:47:38 +01:00
Janne Valkealahti
99275380c3 Tune tests, modify web sample, add more logging
- In web sample change other event C to K which brings
  machine back from S2 to S1.
- Add more logging.
- New test sending parallel events.
2015-08-21 12:59:41 +01:00
Janne Valkealahti
ad3c082670 Tweak ZookeeperStateMachineEnsembleTests await times 2015-08-15 23:03:56 +01:00
Janne Valkealahti
5e2ac9dd84 Tweak tests for being more reliable
- For #76, try to make sure that join is fully done
  before continue sending events.
2015-08-15 17:23:57 +01:00
Janne Valkealahti
d7f5f9f573 Better zk connection error handling
- Modifying concepts around DistributedStateMachine and
  ZookeeperStateMachineEnsemble to get better handling when
  zk connection is lost.
- New jepsen test showing that after a brain split machine
  will get back to a consistent state.
- Polish javadocs
- Hopefully fixes #91
2015-08-15 15:36:52 +01:00
Janne Valkealahti
f12b94e548 Add extended state variable change into test plan
- Add missing test method for testing variable change events.
- This may also contribute to make tests more reliable when
  testing variable values.
- Should contribute to #76 also.
2015-08-14 09:36:17 +01:00
Janne Valkealahti
dea718c13d Making overflow test more reliable 2015-08-14 08:55:34 +01:00
Janne Valkealahti
7c4ab42919 ZookeeperStateMachineEnsemble may miss events
- Adding secondary read if event logs were read which
  should make it less probable losing events at a time
  when main state is changed while logs are replayed.
- Hopefully fixes #97
2015-08-14 08:31:22 +01:00
Janne Valkealahti
7fc7dd9cac Fix potential concurrency issue with join pseudostate
- Change notified flag to volatile which might explain
  some test failures.
- More testing tweaks for #76
2015-08-08 16:30:24 +01:00
Janne Valkealahti
5347ea4dd9 Fix internal transition for dist machine
- Change previous DistributedStateMachine fixes which didn't
  really work. Now explicitely getting state from machine to be set
  into ensemble for post internal transition.
- Now can send Message<E> via test plan instead of plain E.
- More testing for tweaked features.
2015-08-08 10:53:44 +01:00
Janne Valkealahti
4008436d75 Better handling of zk bad version
- Remove propagating BadVersionException from ZookeeperStateMachineEnsemble
  via event so that machine can be kept running. Further logs are then read
  anyway via watcher. Thought we still need better handling but this
  is better for now.
- Relates to #92
2015-08-07 11:15:16 +01:00
Janne Valkealahti
d5257c64e7 Add base feature for error handling
- Add related error handling methods to StateMachine.
- Enhance StateMachineListener and context events around
  error events.
- Modify StateMachineInterceptor and stuff around it order
  to handle errors.
- Fixes #6, fixes #77
2015-07-31 13:11:19 +01:00
Janne Valkealahti
6684b0deda Fixes for zk ensemble operations
- Fix some concurrent event issues which were
  born with new tests
- Enhance tests for dist machine and ensemble
- Add new features to testing system
- Polish and add more logging
2015-07-29 20:15:42 +01:00
Janne Valkealahti
e92a6c5a09 Add test framework skeleton
- Relates to #49
- New project spring-statemachine-test which contains public
  classes to easy generic state machine testing.
- Concepts of StateMachineTestPlan and StateMachineTestPlanBuilder.
- Replaced one zk test to use this framework.
2015-07-26 13:27:10 +01:00
Janne Valkealahti
0fba91cbf2 Fix event overflow
- Fixes #89
- Added new method into EnsembleListeger which can
  be used to listen ensemble errors.
2015-07-25 08:31:03 +01:00
Janne Valkealahti
74f2f72ed6 Fix concepts around internal transitions
- Fixes #86
- Fix internal transition changes when extended
  state variables has been modified. Also internal
  transition is now correctly passed into other
  distributed state machines.
2015-07-24 09:07:03 +01:00
Janne Valkealahti
0cdd833648 Enhance concepts around interceptor
- Rename StateChangeInterceptor to StateMachineInterceptor and
  add methods for pre/post transitions.
- Adding getId concept into a state machine to help distributed
  machines to know from where a state change originates.
- Fix ZookeeperStateMachineEnsemble to work better with
  persisted state machine contexts.
2015-07-19 10:33:28 +01:00
Janne Valkealahti
15c6e507d8 Tweak concepts around state reset
- StateMachineAccess, replace state reset and variables
  with a StateMachineContext.
- Additional fixes to reset state properly even if
  target transition is a super state.
- Some polish
- Add tests
2015-07-15 11:17:43 +01:00
Janne Valkealahti
bba4bc1d28 Add headers and events to serialization
- Relates to #35
- Now event headers and extended state variables
  are serialized with kryo and zookeeper.
2015-07-05 09:52:36 +01:00
Janne Valkealahti
2ac515b04b Polish 2015-07-04 15:34:24 +01:00
Janne Valkealahti
4b858b1d9b Add skeleton for tasks recipe
- Relates to #74
- Tasks recipe not yet fully working, need to get
  this work in to be able to work with other tickets.
- Add childs to StateMachineContext
- A lot of fixes to regions concept throughout
  a code base. Some of the concepts were really broken
  if there were a complex recursive set of regions, etc.
- Add task executor/scheduler to StateMachineBuilder
2015-07-03 14:02:17 +01:00
Janne Valkealahti
44d09f257e Change StateMachinePersist interface
- Remove away from plain serialize/deserialize to write/read
  concept which works better in a generic abstraction.
- Tweak related class in zookeeper package.
- Relates to #35
2015-06-20 15:44:49 +01:00
Janne Valkealahti
742010f1a5 Change distributed machine to use interceptor
- Move away from using state machine listener if favor
  of interceptor which allows to skip state change.
- Remove previously added method in a
  StateMachineListener. (was a bad idea).
- More tweaks to zk example
- Relates to #35
2015-06-18 11:22:37 +01:00
Janne Valkealahti
c68fa5d09d Add skeleton for distributed state machine
- NOTE: not yet fully working distributed sm, this
  commit is considered to be a stage 1 of further
  commits on this matter.
- Preliminary concept of DistributedStateMachine,
  StateMachineEnsemble and StateMachinePersist.
- New module spring-statemachine-zookeeper order to
  persist state in a distributed matter.
- Refactoring concept of a state machine access to get
  better internal access into a sm via functional interfaces.
- Change build to use jdk7 and change test to rely on jdk8
  order to test functional lambdas.
- new zookeeper sample demonstrating distributed concepts.
- Relates t0 #35 and #34.
- No docs until things are fully implemented.
2015-06-12 18:15:50 +01:00