How to create workflows dynamically in Temporal

Team,

Do we need to implement each workflow in a separate workflow class?

Is it recommended to implement a generic workflow class where we will call activities and fire timers using the argument which passed to the workflow?

In our use case, we will be creating workflows from UI and it will be created by the end-user. So we cannot define our workflows initially. it is created on-demand.

How to solve this problem in Temporal?

In Temporal you write a single workflow type which interprets your DSL. The interpreter workflow receives the DSL version as an argument and executes it.

Here is the Go DSL sample to give you the idea.

Thanks for the reply

Here is the [Go DSL sample] Here is the Go DSL sample to give you the idea.

Do we have Java sample for the same

Unfortunately, there is no Java sample yet.

@maxim it would be a great help if you could add Java DSL Sample as I don’t have knowledge in Go language.

Thanks in advance!!

Yes, we have the Java DSL sample planned.