@@ -15,33 +15,15 @@ import (
1515// It manages the underlying DBOSContext and provides methods for workflow operations
1616// without requiring direct management of the context lifecycle.
1717type Client interface {
18- // Enqueue enqueues a workflow to a named queue for deferred execution.
19- // The workflow will be executed when the queue runner processes it.
2018 Enqueue (queueName , workflowName string , input any , opts ... EnqueueOption ) (WorkflowHandle [any ], error )
21-
22- // ListWorkflows retrieves a list of workflows based on the provided filters.
2319 ListWorkflows (opts ... ListWorkflowsOption ) ([]WorkflowStatus , error )
24-
25- // Send sends a message to another workflow.
2620 Send (destinationID string , message any , topic string ) error
27-
28- // GetEvent retrieves a key-value event from a target workflow.
2921 GetEvent (targetWorkflowID , key string , timeout time.Duration ) (any , error )
30-
31- // RetrieveWorkflow returns a handle to an existing workflow.
3222 RetrieveWorkflow (workflowID string ) (WorkflowHandle [any ], error )
33-
34- // CancelWorkflow cancels a running or enqueued workflow.
3523 CancelWorkflow (workflowID string ) error
36-
37- // ResumeWorkflow resumes a workflow from its last completed step.
3824 ResumeWorkflow (workflowID string ) (WorkflowHandle [any ], error )
39-
40- // ForkWorkflow creates a new workflow instance by copying an existing workflow from a specific step.
4125 ForkWorkflow (input ForkWorkflowInput ) (WorkflowHandle [any ], error )
42-
43- // Shutdown gracefully shuts down the client and closes the system database connection.
44- Shutdown (timeout time.Duration )
26+ Shutdown (timeout time.Duration ) // Simply close the system DB connection pool
4527}
4628
4729type client struct {
@@ -196,7 +178,7 @@ func (c *client) Enqueue(queueName, workflowName string, input any, opts ...Enqu
196178// This provides asynchronous workflow execution with durability guarantees.
197179//
198180// Parameters:
199- // - ctx: DBOS context for the operation
181+ // - c: Client instance for the operation
200182// - queueName: Name of the queue to enqueue the workflow to
201183// - workflowName: Name of the registered workflow function to execute
202184// - input: Input parameters to pass to the workflow (type P)
@@ -215,7 +197,7 @@ func (c *client) Enqueue(queueName, workflowName string, input any, opts ...Enqu
215197// Example usage:
216198//
217199// // Enqueue a workflow with string input and int output
218- // handle, err := dbos.Enqueue[string, int](ctx , "data-processing", "ProcessDataWorkflow", "input data",
200+ // handle, err := dbos.Enqueue[string, int](client , "data-processing", "ProcessDataWorkflow", "input data",
219201// dbos.WithEnqueueTimeout(30 * time.Minute))
220202// if err != nil {
221203// log.Fatal(err)
@@ -236,7 +218,7 @@ func (c *client) Enqueue(queueName, workflowName string, input any, opts ...Enqu
236218// }
237219//
238220// // Enqueue with deduplication and custom workflow ID
239- // handle, err := dbos.Enqueue[MyInputType, MyOutputType](ctx , "my-queue", "MyWorkflow", MyInputType{Field: "value"},
221+ // handle, err := dbos.Enqueue[MyInputType, MyOutputType](client , "my-queue", "MyWorkflow", MyInputType{Field: "value"},
240222// dbos.WithEnqueueWorkflowID("custom-workflow-id"),
241223// dbos.WithEnqueueDeduplicationID("unique-operation-id"))
242224func Enqueue [P any , R any ](c Client , queueName , workflowName string , input P , opts ... EnqueueOption ) (WorkflowHandle [R ], error ) {
0 commit comments