Create example workflow

This commit is contained in:
Achim Rohn
2026-04-04 11:02:48 +02:00
parent 9a42091530
commit b5c410c419
3 changed files with 52 additions and 14 deletions
+32 -9
View File
@@ -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 {