Create example workflow
This commit is contained in:
@@ -1,21 +1,44 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.gorlug.de/code/ersteller/queue"
|
||||
"git.gorlug.de/code/ersteller/schema/ent"
|
||||
. "git.gorlug.de/code/ersteller/workflow"
|
||||
)
|
||||
|
||||
func CreateExampleWorkflow(client *ent.Client) {
|
||||
step := NewStep(&StepParams{
|
||||
Name: "Initial step",
|
||||
Identifier: "initial_step",
|
||||
Description: "Initial step",
|
||||
Client: client,
|
||||
MaxRetries: 3,
|
||||
Handler: ,
|
||||
|
||||
lastStep := NewStep(&StepParams{
|
||||
Name: "Last step",
|
||||
Identifier: "last_step",
|
||||
Description: "Last step",
|
||||
Client: client,
|
||||
MaxRetries: 3,
|
||||
Handler: func(ctx context.Context, currentStep *Step, job queue.GeneralQueueJob) (queue.GeneralQueueHandlerResult, *Step, error) {
|
||||
return queue.GeneralQueueHandlerResult{
|
||||
ResultPayload: map[string]interface{}{
|
||||
"lastStep": "hello",
|
||||
},
|
||||
}, nil, nil
|
||||
},
|
||||
})
|
||||
//w := NewWorkflow("Example", "example")
|
||||
|
||||
firstStep := NewStep(&StepParams{
|
||||
Name: "Initial step",
|
||||
Identifier: "initial_step",
|
||||
Description: "Initial step",
|
||||
Client: client,
|
||||
MaxRetries: 3,
|
||||
Handler: func(ctx context.Context, currentStep *Step, job queue.GeneralQueueJob) (queue.GeneralQueueHandlerResult, *Step, error) {
|
||||
return queue.GeneralQueueHandlerResult{
|
||||
ResultPayload: map[string]interface{}{
|
||||
"firstStep": "hello",
|
||||
},
|
||||
}, lastStep, nil
|
||||
},
|
||||
})
|
||||
NewWorkflow("Example", "example", firstStep)
|
||||
}
|
||||
|
||||
//type name struct {
|
||||
|
||||
Reference in New Issue
Block a user