Skip to content

Commit 08b284a

Browse files
Update client wrappers with new async APIs (#1327)
1 parent 68afcb9 commit 08b284a

File tree

8 files changed

+839
-213
lines changed

8 files changed

+839
-213
lines changed

client/client.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ type (
104104
// - InternalServiceError
105105
StartWorkflow(ctx context.Context, options StartWorkflowOptions, workflowFunc interface{}, args ...interface{}) (*workflow.Execution, error)
106106

107+
// StartWorkflowAsync behaves like StartWorkflow except that the request is first queued and then processed asynchronously.
108+
// See StartWorkflow for parameter details.
109+
// The returned AsyncWorkflowExecution doesn't contain run ID, because the workflow hasn't started yet.
110+
// The errors it can return:
111+
// - EntityNotExistsError, if domain does not exists
112+
// - BadRequestError
113+
// - InternalServiceError
114+
StartWorkflowAsync(ctx context.Context, options StartWorkflowOptions, workflow interface{}, args ...interface{}) (*workflow.ExecutionAsync, error)
115+
107116
// ExecuteWorkflow starts a workflow execution and return a WorkflowRun instance and error
108117
// The user can use this to start using a function or workflow type name.
109118
// Either by
@@ -169,6 +178,15 @@ type (
169178
SignalWithStartWorkflow(ctx context.Context, workflowID string, signalName string, signalArg interface{},
170179
options StartWorkflowOptions, workflowFunc interface{}, workflowArgs ...interface{}) (*workflow.Execution, error)
171180

181+
// SignalWithStartWorkflowAsync behaves like SignalWithStartWorkflow except that the request is first queued and then processed asynchronously.
182+
// See SignalWithStartWorkflow for parameter details.
183+
// The errors it can return:
184+
// - EntityNotExistsError, if domain does not exist
185+
// - BadRequestError
186+
// - InternalServiceError
187+
SignalWithStartWorkflowAsync(ctx context.Context, workflowID string, signalName string, signalArg interface{},
188+
options StartWorkflowOptions, workflow interface{}, workflowArgs ...interface{}) (*workflow.ExecutionAsync, error)
189+
172190
// CancelWorkflow cancels a workflow in execution
173191
// - workflow ID of the workflow.
174192
// - runID can be default(empty string). if empty string then it will pick the running execution of that workflow ID.

internal/client.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ type (
9393
// subjected to change in the future.
9494
StartWorkflow(ctx context.Context, options StartWorkflowOptions, workflow interface{}, args ...interface{}) (*WorkflowExecution, error)
9595

96+
// StartWorkflowAsync behaves like StartWorkflow except that the request is first queued and then processed asynchronously.
97+
// See StartWorkflow for parameter details.
98+
// The returned AsyncWorkflowExecution doesn't contain run ID, because the workflow hasn't started yet.
99+
// The errors it can return:
100+
// - EntityNotExistsError, if domain does not exists
101+
// - BadRequestError
102+
// - InternalServiceError
103+
StartWorkflowAsync(ctx context.Context, options StartWorkflowOptions, workflow interface{}, args ...interface{}) (*WorkflowExecutionAsync, error)
104+
96105
// ExecuteWorkflow starts a workflow execution and return a WorkflowRun instance and error
97106
// The user can use this to start using a function or workflow type name.
98107
// Either by
@@ -160,6 +169,15 @@ type (
160169
SignalWithStartWorkflow(ctx context.Context, workflowID string, signalName string, signalArg interface{},
161170
options StartWorkflowOptions, workflow interface{}, workflowArgs ...interface{}) (*WorkflowExecution, error)
162171

172+
// SignalWithStartWorkflowAsync behaves like SignalWithStartWorkflow except that the request is first queued and then processed asynchronously.
173+
// See SignalWithStartWorkflow for parameter details.
174+
// The errors it can return:
175+
// - EntityNotExistsError, if domain does not exist
176+
// - BadRequestError
177+
// - InternalServiceError
178+
SignalWithStartWorkflowAsync(ctx context.Context, workflowID string, signalName string, signalArg interface{},
179+
options StartWorkflowOptions, workflow interface{}, workflowArgs ...interface{}) (*WorkflowExecutionAsync, error)
180+
163181
// CancelWorkflow cancels a workflow in execution
164182
// - workflow ID of the workflow.
165183
// - runID can be default(empty string). if empty string then it will pick the running execution of that workflow ID.

internal/common/metrics/constants.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,21 @@ package metrics
2222

2323
// Workflow Creation metrics
2424
const (
25-
CadenceMetricsPrefix = "cadence-"
26-
WorkflowStartCounter = CadenceMetricsPrefix + "workflow-start"
27-
WorkflowCompletedCounter = CadenceMetricsPrefix + "workflow-completed"
28-
WorkflowCanceledCounter = CadenceMetricsPrefix + "workflow-canceled"
29-
WorkflowFailedCounter = CadenceMetricsPrefix + "workflow-failed"
30-
WorkflowContinueAsNewCounter = CadenceMetricsPrefix + "workflow-continue-as-new"
31-
WorkflowEndToEndLatency = CadenceMetricsPrefix + "workflow-endtoend-latency" // measure workflow execution from start to close
32-
WorkflowGetHistoryCounter = CadenceMetricsPrefix + "workflow-get-history-total"
33-
WorkflowGetHistoryFailedCounter = CadenceMetricsPrefix + "workflow-get-history-failed"
34-
WorkflowGetHistorySucceedCounter = CadenceMetricsPrefix + "workflow-get-history-succeed"
35-
WorkflowGetHistoryLatency = CadenceMetricsPrefix + "workflow-get-history-latency"
36-
WorkflowSignalWithStartCounter = CadenceMetricsPrefix + "workflow-signal-with-start"
37-
DecisionTimeoutCounter = CadenceMetricsPrefix + "decision-timeout"
25+
CadenceMetricsPrefix = "cadence-"
26+
WorkflowStartCounter = CadenceMetricsPrefix + "workflow-start"
27+
WorkflowStartAsyncCounter = CadenceMetricsPrefix + "workflow-start-async"
28+
WorkflowCompletedCounter = CadenceMetricsPrefix + "workflow-completed"
29+
WorkflowCanceledCounter = CadenceMetricsPrefix + "workflow-canceled"
30+
WorkflowFailedCounter = CadenceMetricsPrefix + "workflow-failed"
31+
WorkflowContinueAsNewCounter = CadenceMetricsPrefix + "workflow-continue-as-new"
32+
WorkflowEndToEndLatency = CadenceMetricsPrefix + "workflow-endtoend-latency" // measure workflow execution from start to close
33+
WorkflowGetHistoryCounter = CadenceMetricsPrefix + "workflow-get-history-total"
34+
WorkflowGetHistoryFailedCounter = CadenceMetricsPrefix + "workflow-get-history-failed"
35+
WorkflowGetHistorySucceedCounter = CadenceMetricsPrefix + "workflow-get-history-succeed"
36+
WorkflowGetHistoryLatency = CadenceMetricsPrefix + "workflow-get-history-latency"
37+
WorkflowSignalWithStartCounter = CadenceMetricsPrefix + "workflow-signal-with-start"
38+
WorkflowSignalWithStartAsyncCounter = CadenceMetricsPrefix + "workflow-signal-with-start-async"
39+
DecisionTimeoutCounter = CadenceMetricsPrefix + "decision-timeout"
3840

3941
DecisionPollCounter = CadenceMetricsPrefix + "decision-poll-total"
4042
DecisionPollFailedCounter = CadenceMetricsPrefix + "decision-poll-failed"

0 commit comments

Comments
 (0)