RahulAggarwal
RahulAggarwal

Reputation: 61

Can i use Spring State machine where single state is mapped with multiple status

1 I'm trying to use Spring State Machine in my project, because there is an object is Order with several state and there can be different status corresponding to each state.

STATE STATUS

NEW --------> pending

NEW --------> paymentPending

PROCESSING -------> PROCESSING_NEW

PROCESSING -------> PROCESSING_COMPLETE

COMPLETE ----------> COMPLETE_SHIPPED

COMPLETE ----------> DELIVERED

So how do i implement this if i have differet status also mapped to different states.

Upvotes: 1

Views: 268

Answers (1)

mirmdasif
mirmdasif

Reputation: 6354

I am afraid you can't. Spring state machine is a deterministic state machine and it has only one current state. And any event can take change state of the machine to a single state.

In a deterministic state machine, each element of LHS is mapped only once to an element on the right i.e. on receiving a particular input it makes a single transition. On giving input a to state A it will go to state B

enter image description here

Upvotes: 1

Related Questions