@@ -3,9 +3,7 @@ package backend
3
3
import (
4
4
"context"
5
5
"errors"
6
- "log/slog"
7
6
8
- "github.com/cschleiden/go-workflows/backend/converter"
9
7
"github.com/cschleiden/go-workflows/backend/history"
10
8
"github.com/cschleiden/go-workflows/backend/metrics"
11
9
"github.com/cschleiden/go-workflows/core"
@@ -42,47 +40,47 @@ type Backend interface {
42
40
// If the given instance does not exist, it will return an error
43
41
SignalWorkflow (ctx context.Context , instanceID string , event * history.Event ) error
44
42
43
+ // PrepareWorkflowQueues prepares workflow queues for later consumption using this backend instane
44
+ PrepareWorkflowQueues (ctx context.Context , queues []workflow.Queue ) error
45
+
46
+ // PrepareActivityQueues prepares activity queues for later consumption using this backend instance
47
+ PrepareActivityQueues (ctx context.Context , queues []workflow.Queue ) error
48
+
45
49
// GetWorkflowTask returns a pending workflow task or nil if there are no pending workflow executions
46
- GetWorkflowTask (ctx context.Context ) (* WorkflowTask , error )
50
+ GetWorkflowTask (ctx context.Context , queues []workflow. Queue ) (* WorkflowTask , error )
47
51
48
52
// ExtendWorkflowTask extends the lock of a workflow task
49
- ExtendWorkflowTask (ctx context.Context , taskID string , instance * core. WorkflowInstance ) error
53
+ ExtendWorkflowTask (ctx context.Context , task * WorkflowTask ) error
50
54
51
55
// CompleteWorkflowTask checkpoints a workflow task retrieved using GetWorkflowTask
52
56
//
53
57
// This checkpoints the execution. events are new events from the last workflow execution
54
58
// which will be added to the workflow instance history. workflowEvents are new events for the
55
59
// completed or other workflow instances.
56
60
CompleteWorkflowTask (
57
- ctx context.Context , task * WorkflowTask , instance * workflow. Instance , state core.WorkflowInstanceState ,
61
+ ctx context.Context , task * WorkflowTask , state core.WorkflowInstanceState ,
58
62
executedEvents , activityEvents , timerEvents []* history.Event , workflowEvents []* history.WorkflowEvent ) error
59
63
60
64
// GetActivityTask returns a pending activity task or nil if there are no pending activities
61
- GetActivityTask (ctx context.Context ) (* ActivityTask , error )
62
-
63
- // CompleteActivityTask completes an activity task retrieved using GetActivityTask
64
- CompleteActivityTask (ctx context.Context , instance * workflow.Instance , activityID string , event * history.Event ) error
65
+ GetActivityTask (ctx context.Context , queues []workflow.Queue ) (* ActivityTask , error )
65
66
66
67
// ExtendActivityTask extends the lock of an activity task
67
- ExtendActivityTask (ctx context.Context , activityID string ) error
68
+ ExtendActivityTask (ctx context.Context , task * ActivityTask ) error
69
+
70
+ // CompleteActivityTask completes an activity task retrieved using GetActivityTask
71
+ CompleteActivityTask (ctx context.Context , task * ActivityTask , result * history.Event ) error
68
72
69
73
// GetStats returns stats about the backend
70
74
GetStats (ctx context.Context ) (* Stats , error )
71
75
72
- // Logger returns the configured logger for the backend
73
- Logger () * slog.Logger
74
-
75
76
// Tracer returns the configured trace provider for the backend
76
77
Tracer () trace.Tracer
77
78
78
79
// Metrics returns the configured metrics client for the backend
79
80
Metrics () metrics.Client
80
81
81
- // Converter returns the configured converter for the backend
82
- Converter () converter.Converter
83
-
84
- // ContextPropagators returns the configured context propagators for the backend
85
- ContextPropagators () []workflow.ContextPropagator
82
+ // Options returns the configured options for the backend
83
+ Options () * Options
86
84
87
85
// Close closes any underlying resources
88
86
Close () error
0 commit comments