State stored externally in a database

47 views
Skip to first unread message

Siddharth Patnaik

unread,
Mar 31, 2021, 12:52:24 AM3/31/21
to squirrel state machine
Hi,
Here is my scenario:
1. We have a state model defined for an order management service. Order has around 10 states and the transitions are defined between them
2. The order state is stored in a database
3. When an event is received (say order delivered), the state is retrieved from db, and the event should be fed into the state machine . The transition logic should get executed and the target state should be updated back in db

To be able to do this, what I want is while firing an event, the API should also take the current state. Basically, I don't want the state machine to remember the current state, however, it should be possible to pass in the API.

Can someone please help with this?

Thanks,
Siddharth

bogun....@gmail.com

unread,
Apr 5, 2021, 1:01:55 PM4/5/21
to Siddharth Patnaik, squirrel state machine
You are passing initial state into `org.squirrelframework.foundation.fsm.StateMachineBuilder#newStateMachine(S, java.lang.Object...)` is this the API you are looking for?

ср, 31 мар. 2021 г. в 07:52, Siddharth Patnaik <spatn...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "squirrel state machine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to squirrel-state-ma...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/squirrel-state-machine/59479361-6d20-4d7f-80e3-fbd191520194n%40googlegroups.com.

Siddharth Patnaik

unread,
Apr 7, 2021, 12:30:31 AM4/7/21
to bogun....@gmail.com, squirrel state machine
Hi,
I am expecting an API as below in StateMachine Interface:
void fire(State currentState, E var1, C var2);
I don't want the state machine to remember the current state rather i should be able to pass it while executing an event. 
Hope i am clear. Please let me know if you need any further information.

Thanks,
Siddharth

--
Best Regards,
Siddharth

Siddharth Patnaik

unread,
Apr 15, 2021, 12:42:03 PM4/15/21
to bogun....@gmail.com, squirrel state machine
Hi - Any update on this?

Thanks,
Siddharth
--
Best Regards,
Siddharth
Reply all
Reply to author
Forward
0 new messages