question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request : Add a utility to the state machine to allow consuming code to subscribe to any state change

See original GitHub issue

Copied from my original request :

I would like to add an implementation in my state machine definition that would allow me to execute some code when ever the state of a saga instance changes. That is regardless of what the current state of the saga.

In the state machine definition it would be nice if we can define something like : WhenEnter(State.Any,Callback ... or WhenEnterAnyState(Callback ... and something similar. That way we can define a common code to execute whenever the state of the saga changes.

It is worth mentioning here that, in the current version of MT(3.1.0.0) I was able to achieve something similar by creating my own version version of the “TransitionTo” extension method. like below (I hope it doesn’t make you cringe too much)

public static EventActivityBinder< TInstance, TData > TransitionToAndBlah< TInstance, TData >(
            this EventActivityBinder< TInstance, TData > source,
            State toState) where TInstance : MrCycle
        {
            return source.TransitionTo( toState ).Add( new ActionActivity< TInstance, TData >(MyCallBack);
        }

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
phatboygcommented, Jan 20, 2016

So move beyond the current:

WhenEnter(Running, x => x.Then(...));

And add the ability to observe and react to any state change, taking the from/to state as an input parameter?

0reactions
jakerg23commented, Mar 2, 2016

Perfect, looking forward to it, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AASM - Ruby state machines
This package contains AASM, a library for adding finite state machines to Ruby classes. AASM started as the acts_as_state_machine plugin but has evolved ......
Read more >
Introducing the Amazon EventBridge service integration for ...
It allows customers to publish events to a specified event bus directly from a workflow, using one of two integration patterns: Request-Response ...
Read more >
UpdateStateMachine - AWS Step Functions
Updates an existing state machine by modifying its definition , roleArn , or loggingConfiguration . Running executions will continue to use the previous ......
Read more >
Resolving view state message authentication code (MAC) ...
Describes view state and how to resolve message authentication code (MAC) errors.
Read more >
Change feed processor in Azure Cosmos DB
In this configuration, each deployment unit maintains an independent state on the lease container. Review the request unit consumption on a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found