Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic definition and evaluation of states machine #9

Closed
daya opened this issue Jan 9, 2021 · 6 comments
Closed

Dynamic definition and evaluation of states machine #9

daya opened this issue Jan 9, 2021 · 6 comments

Comments

@daya
Copy link

daya commented Jan 9, 2021

Using something like States Language editor and resulting json output, is it possible to dynamically (at runtime) define state machines and have the state machine executed/evaluated?

@entone
Copy link
Contributor

entone commented Jan 10, 2021 via email

@daya
Copy link
Author

daya commented Jan 11, 2021

Thanks for the reply @entone my use case is a logged in User using some Editor (like states-language editor) is able to define a State machine with all the steps, branching logic and callouts (webhooks). The system/application will then run one or more executions of this user defined state machine and generate report on them.

Obviously as you can make out there will be a Schema based on the business domain which will control the possible state machines that can be generated.

Do you think this kind of runtime creation and execution of state machines is easy enough to implement states_language? or will it require too much arm twisting?

@entone
Copy link
Contributor

entone commented Jan 11, 2021 via email

@daya
Copy link
Author

daya commented Jan 11, 2021

the macro should accept the JSON file or Map structure and generate a module at runtime, you
can then start a process based on the compiled module.

Right that's one high level interface to the internals, and I hope you meant something along these lines, right?

defmodule MyModule do

use StatesLanguage, data: %{state1: %{}, state2: %{}} 

end

but as that is compile time still, I am looking for some place in code base where that compile time configuration is executed to interpret the graph into a gen_statem process. Could you please help me with a pointer to that module/line?

@entone
Copy link
Contributor

entone commented Jan 11, 2021 via email

@entone entone closed this as completed Sep 17, 2021
@entone
Copy link
Contributor

entone commented Oct 6, 2021

@daya not sure if you ever figured this out, but I put together an example, https://github.com/entropealabs/states_language_runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants