stateMachine := stateless.NewStateMachine(initial)
stateMachine.Configure(initial).Permit(TriggerProcessing, processing)
stateMachine.Configure(processing).
OnEntryFrom(err, func(ctx context.Context, args ...any) error {
// signal that the processing has started
println("processing started after error")
return nil
}).
OnEntryFrom(TriggerProcessing, func(ctx context.Context, args ...any) error {
// signal that the processing has started
println("processing started on uploading data")
return nil
}).
OnExit(func(ctx context.Context, args ...any) error {
// signal that the processing has finished
println("processing finished")
return nil
}).
Permit(TriggerDone, done)
stateMachine.Configure(done).
OnEntry(func(ctx context.Context, args ...any) error {
// signal done
println("done")
return nil
}).
OnExit(func(ctx context.Context, args ...any) error {
// signal that it is leaving the done state
println("leaving done state")
return nil
}).
Permit(TriggerProcessing, processing)
when i then fire a trigger "TriggerProcessing" on the stateMachine, i get the following error:
unexpected error: stateless: No valid leaving transitions are permitted from state 'StateMachine {{ State = initial, PermittedTriggers = [triggerProcessing] }}' for trigger 'triggerProcessing', consider ignoring the trigger
Right now i really cant tell what goes wrong and i would appreciate your help very much. I simply followed the concept from the example..
I tried out multiple things to get rid of this issue, but it didnt help (Ignore, Guards, etc. )
Hi,
So far, I followed the instructions on how to use this lib and cant get it running.
this is how i define the states and triggers.
this is how i configure the state machine...
when i then fire a trigger "TriggerProcessing" on the stateMachine, i get the following error:
Right now i really cant tell what goes wrong and i would appreciate your help very much. I simply followed the concept from the example..
I tried out multiple things to get rid of this issue, but it didnt help (Ignore, Guards, etc. )