README
¶
This sample demonstrates how to implement a DSL workflow. In this sample, we provide 2 sample yaml files each defines a custom workflow that can be processed by this DSL workflow sample code.
Steps to run this sample:
- You need a Temporal service running. See README.md for more details.
- Run
go run dsl/worker/main.go
to start worker for dsl workflow. 3) Run
go run dsl/starter/main.go
to submit start request for workflow defined in workflow1.yaml
file.
Next:
- You can run
go run dsl/starter/main.go -dslConfig=dsl/workflow2.yaml
to see the result. 2) You can also write your own yaml config to play with it. 3) You can replace the dummy activities to your own real activities to build real workflow based on this simple DSL workflow.
Documentation
¶
Index ¶
- func SimpleDSLWorkflow(ctx workflow.Context, dslWorkflow Workflow) ([]byte, error)
- type ActivityInvocation
- type Parallel
- type SampleActivities
- func (a *SampleActivities) SampleActivity1(ctx context.Context, input []string) (string, error)
- func (a *SampleActivities) SampleActivity2(ctx context.Context, input []string) (string, error)
- func (a *SampleActivities) SampleActivity3(ctx context.Context, input []string) (string, error)
- func (a *SampleActivities) SampleActivity4(ctx context.Context, input []string) (string, error)
- func (a *SampleActivities) SampleActivity5(ctx context.Context, input []string) (string, error)
- type Sequence
- type Statement
- type Workflow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActivityInvocation ¶
ActivityInvocation is used to express invoking an Activity. The Arguments defined expected arguments as input to the Activity, the result specify the name of variable that it will store the result as which can then be used as arguments to subsequent ActivityInvocation.
type Parallel ¶
type Parallel struct {
Branches []*Statement
}
Parallel can be a collection of Statements that runs in parallel.
type SampleActivities ¶
type SampleActivities struct { }
func (*SampleActivities) SampleActivity1 ¶
func (*SampleActivities) SampleActivity2 ¶
func (*SampleActivities) SampleActivity3 ¶
func (*SampleActivities) SampleActivity4 ¶
func (*SampleActivities) SampleActivity5 ¶
type Sequence ¶
type Sequence struct {
Elements []*Statement
}
Sequence consist of a collection of Statements that runs in sequential.
type Statement ¶
type Statement struct { Activity *ActivityInvocation Sequence *Sequence Parallel *Parallel }
Statement is the building block of dsl workflow. A Statement can be a simple ActivityInvocation or it could be a Sequence or Parallel.