The bustling Spring universe has officially gained a new addition this week with the launch of Spring  Statemachine 1.0 – a framework that allows application developers to use state machine concepts with Spring. Its core features include the following:

  • Easy to use flat one level state machine for simple use cases.

  • Hierarchical state machine structure to ease complex state configuration.

  • State machine regions to provide even more complex state configurations.

  • Usage of triggers, transitions, guards and actions.

  • Type safe configuration adapter.

  • Builder pattern for easy instantiation for use outside of Spring Application context

  • Recipes for usual use cases

  • Distributed state machine based on a Zookeeper

  • State machine event listeners.

  • Spring IOC integration to associate beans with a state machine.

Spring Statemachine has its roots in the base work done for Spring Hadoop, which took place in Q1 this year. Writing in the official Spring blog, Janne Valkealahti explains that the idea for this project came about when he ran into difficulties implementing a new container grouping feature in Spring YARN, thanks to the asynchronous nature of Hadoop YARN resource manager.

Faced with the prospect of having to “out-code” himself, Valkealahti quickly realised he needed a state machine. Once implemented, with the machine in place to control all the logic “which had to happen in a specific order while all communication towards a YARN resource manager still happened asynchronously,” Valkealahti easily solved his problem. Realising that there would be value in forking the state machine into its own project, Valkealahti comments that he was surprised at the traction the project gained once it was loosed onto the community as an official Spring Project.

Conveniently, now that this project is GA, the team now have a ready made replacement for Spring YARN internal state machine. Whilst there’s no full roadmap for the project, there could be a few additional features added down down the line which would enhance existing concepts in the project. There will also be work done to ensure the baseline remains level with future Spring Framework releases.

You can jump into Spring Statemachine here.

 

Planet Spring Gets a New State Machine

| Java Language| 434 views | 2 Comments
About The Author
- Editor of Voxxed.com, focusing on all things Java, JVM, cloud-y, methodical, future-fantastic, and everything in between. Got a piece of news, article or tutorial you'd like to share with your fellow Voxxians? Drop us a line at info@voxxed.com

2 Comments

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>