Skip to content

Commit a41c592

Browse files
committed
workflows support reuse id policy
Signed-off-by: Fabian Martinez <[email protected]>
1 parent 9bc7d82 commit a41c592

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

workflow/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ func WithStartTime(time time.Time) api.NewOrchestrationOptions {
5353
return api.WithStartTime(time)
5454
}
5555

56+
func WithReuseIDPolicy(policy *api.OrchestrationIdReusePolicy) api.NewOrchestrationOptions {
57+
return api.WithOrchestrationIdReusePolicy(policy)
58+
}
59+
5660
// WithFetchPayloads is an option to return the payload from a workflow.
5761
func WithFetchPayloads(fetchPayloads bool) api.FetchOrchestrationMetadataOptions {
5862
return api.WithFetchPayloads(fetchPayloads)

workflow/client_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"context"
1919
"testing"
2020

21+
"github.com/microsoft/durabletask-go/api"
2122
"github.com/stretchr/testify/assert"
2223
"github.com/stretchr/testify/require"
2324

@@ -54,7 +55,10 @@ func TestClientMethods(t *testing.T) {
5455
}
5556
ctx := context.Background()
5657
t.Run("ScheduleNewWorkflow - empty wf name", func(t *testing.T) {
57-
id, err := testClient.ScheduleNewWorkflow(ctx, "", nil)
58+
id, err := testClient.ScheduleNewWorkflow(ctx, "", WithReuseIDPolicy(&api.OrchestrationIdReusePolicy{
59+
OperationStatus: []api.OrchestrationStatus{api.RUNTIME_STATUS_COMPLETED},
60+
Action: api.REUSE_ID_ACTION_IGNORE,
61+
}))
5862
require.Error(t, err)
5963
assert.Empty(t, id)
6064
})

0 commit comments

Comments
 (0)