From 353a2f41aa604bcaf7e60daf9f6f0a8d04e44db0 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Wed, 13 Dec 2017 10:06:39 -0800 Subject: [PATCH 1/5] Revert "Revert "add support for sticky query (#452)" (#459)" This reverts commit 4176791691c7acb32eae3129941094c4f130f252. --- .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 64 ++- Makefile | 4 +- host/integration_test.go | 560 +++++++++++++++------- idl/github.com/uber/cadence/shared.thrift | 2 + service/frontend/handler.go | 196 ++++---- service/history/historyEngine.go | 3 +- service/matching/matchingEngine.go | 19 +- 8 files changed, 549 insertions(+), 303 deletions(-) diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index bbf50b7f85d..4c3ec8da04e 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "061e5d77656c005af99aa473b47809cc1c0247ab", + SHA1: "0da8f44f08f449b9155322473141320082b109e2", Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional string identity\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n 50: optional TaskList stickyTaskList\n 60: optional i32 stickyScheduleToStartTimeoutSeconds\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional string identity\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index 51b3444e560..c9b2153b424 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -23098,6 +23098,8 @@ type WorkflowExecutionConfiguration struct { ExecutionStartToCloseTimeoutSeconds *int32 `json:"executionStartToCloseTimeoutSeconds,omitempty"` TaskStartToCloseTimeoutSeconds *int32 `json:"taskStartToCloseTimeoutSeconds,omitempty"` ChildPolicy *ChildPolicy `json:"childPolicy,omitempty"` + StickyTaskList *TaskList `json:"stickyTaskList,omitempty"` + StickyScheduleToStartTimeoutSeconds *int32 `json:"stickyScheduleToStartTimeoutSeconds,omitempty"` } // ToWire translates a WorkflowExecutionConfiguration struct into a Thrift-level intermediate @@ -23117,7 +23119,7 @@ type WorkflowExecutionConfiguration struct { // } func (v *WorkflowExecutionConfiguration) ToWire() (wire.Value, error) { var ( - fields [4]wire.Field + fields [6]wire.Field i int = 0 w wire.Value err error @@ -23155,6 +23157,22 @@ func (v *WorkflowExecutionConfiguration) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 40, Value: w} i++ } + if v.StickyTaskList != nil { + w, err = v.StickyTaskList.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 50, Value: w} + i++ + } + if v.StickyScheduleToStartTimeoutSeconds != nil { + w, err = wire.NewValueI32(*(v.StickyScheduleToStartTimeoutSeconds)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 60, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -23218,6 +23236,24 @@ func (v *WorkflowExecutionConfiguration) FromWire(w wire.Value) error { return err } + } + case 50: + if field.Value.Type() == wire.TStruct { + v.StickyTaskList, err = _TaskList_Read(field.Value) + if err != nil { + return err + } + + } + case 60: + if field.Value.Type() == wire.TI32 { + var x int32 + x, err = field.Value.GetI32(), error(nil) + v.StickyScheduleToStartTimeoutSeconds = &x + if err != nil { + return err + } + } } } @@ -23232,7 +23268,7 @@ func (v *WorkflowExecutionConfiguration) String() string { return "" } - var fields [4]string + var fields [6]string i := 0 if v.TaskList != nil { fields[i] = fmt.Sprintf("TaskList: %v", v.TaskList) @@ -23250,6 +23286,14 @@ func (v *WorkflowExecutionConfiguration) String() string { fields[i] = fmt.Sprintf("ChildPolicy: %v", *(v.ChildPolicy)) i++ } + if v.StickyTaskList != nil { + fields[i] = fmt.Sprintf("StickyTaskList: %v", v.StickyTaskList) + i++ + } + if v.StickyScheduleToStartTimeoutSeconds != nil { + fields[i] = fmt.Sprintf("StickyScheduleToStartTimeoutSeconds: %v", *(v.StickyScheduleToStartTimeoutSeconds)) + i++ + } return fmt.Sprintf("WorkflowExecutionConfiguration{%v}", strings.Join(fields[:i], ", ")) } @@ -23271,6 +23315,12 @@ func (v *WorkflowExecutionConfiguration) Equals(rhs *WorkflowExecutionConfigurat if !_ChildPolicy_EqualsPtr(v.ChildPolicy, rhs.ChildPolicy) { return false } + if !((v.StickyTaskList == nil && rhs.StickyTaskList == nil) || (v.StickyTaskList != nil && rhs.StickyTaskList != nil && v.StickyTaskList.Equals(rhs.StickyTaskList))) { + return false + } + if !_I32_EqualsPtr(v.StickyScheduleToStartTimeoutSeconds, rhs.StickyScheduleToStartTimeoutSeconds) { + return false + } return true } @@ -23305,6 +23355,16 @@ func (v *WorkflowExecutionConfiguration) GetChildPolicy() (o ChildPolicy) { return } +// GetStickyScheduleToStartTimeoutSeconds returns the value of StickyScheduleToStartTimeoutSeconds if it is set or its +// zero value if it is unset. +func (v *WorkflowExecutionConfiguration) GetStickyScheduleToStartTimeoutSeconds() (o int32) { + if v.StickyScheduleToStartTimeoutSeconds != nil { + return *v.StickyScheduleToStartTimeoutSeconds + } + + return +} + type WorkflowExecutionContinuedAsNewEventAttributes struct { NewExecutionRunId *string `json:"newExecutionRunId,omitempty"` WorkflowType *WorkflowType `json:"workflowType,omitempty"` diff --git a/Makefile b/Makefile index 281a41ce4de..00c1f469f73 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,7 @@ test: vendor/glide.updated bins @rm -f test @rm -f test.log @for dir in $(TEST_DIRS); do \ - go test -coverprofile=$@ "$$dir" | tee -a test.log; \ + go test -race -coverprofile=$@ "$$dir" | tee -a test.log; \ done; cover_profile: clean bins_nothrift @@ -99,7 +99,7 @@ cover_profile: clean bins_nothrift @echo "mode: atomic" > $(BUILD)/cover.out @echo Running integration test - @mkdir -p $(BUILD)/$(INTEG_TEST_DIR) + @mkdir -p $(BUILD)/$(INTEG_TEST_DIR) @time go test $(INTEG_TEST_ROOT) $(TEST_ARG) $(GOCOVERPKG_ARG) -coverprofile=$(BUILD)/$(INTEG_TEST_DIR)/coverage.out || exit 1; @cat $(BUILD)/$(INTEG_TEST_DIR)/coverage.out | grep -v "mode: atomic" >> $(BUILD)/cover.out diff --git a/host/integration_test.go b/host/integration_test.go index 87d48db5d0f..bbc0b812724 100644 --- a/host/integration_test.go +++ b/host/integration_test.go @@ -78,15 +78,17 @@ type ( queryHandler func(task *workflow.PollForDecisionTaskResponse) ([]byte, error) taskPoller struct { - engine frontend.Client - domain string - taskList *workflow.TaskList - identity string - decisionHandler decisionTaskHandler - activityHandler activityTaskHandler - queryHandler queryHandler - logger bark.Logger - suite *integrationSuite + engine frontend.Client + domain string + taskList *workflow.TaskList + sticktTaskList *workflow.TaskList + stickyScheduleToStartTimeoutSeconds *int32 + identity string + decisionHandler decisionTaskHandler + activityHandler activityTaskHandler + queryHandler queryHandler + logger bark.Logger + suite *integrationSuite } ) @@ -287,7 +289,7 @@ func (s *integrationSuite) TestTerminateWorkflow() { suite: s, } - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -459,7 +461,7 @@ func (s *integrationSuite) TestSequentialWorkflow() { } for i := 0; i < 10; i++ { - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) err = poller.pollAndProcessActivityTask(false) @@ -468,68 +470,116 @@ func (s *integrationSuite) TestSequentialWorkflow() { } s.False(workflowComplete) - s.Nil(poller.pollAndProcessDecisionTask(true, false)) + _, err := poller.pollAndProcessDecisionTask(true, false) + s.Nil(err) s.True(workflowComplete) } -func (p *taskPoller) pollAndProcessDecisionTask(dumpHistory bool, dropTask bool) error { - return p.pollAndProcessDecisionTaskWithAttempt(dumpHistory, dropTask, int64(0)) +func (p *taskPoller) pollAndProcessDecisionTask(dumpHistory bool, dropTask bool) (isQueryTask bool, err error) { + return p.pollAndProcessDecisionTaskWithAttempt(dumpHistory, dropTask, false, false, int64(0)) +} + +func (p *taskPoller) pollAndProcessDecisionTaskWithSticky(dumpHistory bool, dropTask bool) (isQueryTask bool, err error) { + return p.pollAndProcessDecisionTaskWithAttempt(dumpHistory, dropTask, true, true, int64(0)) } func (p *taskPoller) pollAndProcessDecisionTaskWithAttempt(dumpHistory bool, dropTask bool, - decisionAttempt int64) error { -retry: + pollStickyTaskList bool, respondStickyTaskList bool, decisionAttempt int64) (isQueryTask bool, err error) { +Loop: for attempt := 0; attempt < 5; attempt++ { + + taskList := p.taskList + if pollStickyTaskList { + taskList = p.sticktTaskList + } response, err1 := p.engine.PollForDecisionTask(createContext(), &workflow.PollForDecisionTaskRequest{ Domain: common.StringPtr(p.domain), - TaskList: p.taskList, + TaskList: taskList, Identity: common.StringPtr(p.identity), }) if err1 == history.ErrDuplicate { p.logger.Info("Duplicate Decision task: Polling again.") - continue retry + continue Loop } if err1 != nil { - return err1 + return false, err1 } if response == nil || len(response.TaskToken) == 0 { p.logger.Info("Empty Decision task: Polling again.") - continue retry + continue Loop } - history := response.History - if history == nil { - p.logger.Fatal("History is nil") - } + var events []*workflow.HistoryEvent + if response.Query == nil || !pollStickyTaskList { + // if not query task, should have some history events + // for non sticky query, there should be events returned + history := response.History + if history == nil { + p.logger.Fatal("History is nil") + } - events := history.Events - if events == nil || len(events) == 0 { - p.logger.Fatalf("History Events are empty: %v", events) - } + events = history.Events + if events == nil || len(events) == 0 { + p.logger.Fatalf("History Events are empty: %v", events) + } - nextPageToken := response.NextPageToken - for nextPageToken != nil { - resp, err2 := p.engine.GetWorkflowExecutionHistory(createContext(), &workflow.GetWorkflowExecutionHistoryRequest{ - Domain: common.StringPtr(p.domain), - Execution: response.WorkflowExecution, - NextPageToken: nextPageToken, - }) + nextPageToken := response.NextPageToken + for nextPageToken != nil { + resp, err2 := p.engine.GetWorkflowExecutionHistory(createContext(), &workflow.GetWorkflowExecutionHistoryRequest{ + Domain: common.StringPtr(p.domain), + Execution: response.WorkflowExecution, + NextPageToken: nextPageToken, + }) - if err2 != nil { - return err2 + if err2 != nil { + return false, err2 + } + + events = append(events, resp.History.Events...) + nextPageToken = resp.NextPageToken + } + } else { + // for sticky query, there should be NO events returned + // since worker side already has the state machine and we do not intend to update that. + history := response.History + nextPageToken := response.NextPageToken + if !(history == nil || (len(history.Events) == 0 && nextPageToken == nil)) { + // if history is not nil, and contains events or next token + p.logger.Fatal("History is not empty for sticky query") } + } - events = append(events, resp.History.Events...) - nextPageToken = resp.NextPageToken + if dropTask { + p.logger.Info("Dropping Decision task: ") + return false, nil } if dumpHistory { common.PrettyPrintHistory(response.History, p.logger) } + // handle query task response + if response.Query != nil { + blob, err := p.queryHandler(response) + + completeRequest := &workflow.RespondQueryTaskCompletedRequest{TaskToken: response.TaskToken} + if err != nil { + completeType := workflow.QueryTaskCompletedTypeFailed + completeRequest.CompletedType = &completeType + completeRequest.ErrorMessage = common.StringPtr(err.Error()) + } else { + completeType := workflow.QueryTaskCompletedTypeCompleted + completeRequest.CompletedType = &completeType + completeRequest.QueryResult = blob + } + + return true, p.engine.RespondQueryTaskCompleted(createContext(), completeRequest) + } + + // handle normal decirsion task / non query task response var lastDecisionScheduleEvent *workflow.HistoryEvent for _, e := range events { if e.GetEventType() == workflow.EventTypeDecisionTaskScheduled { @@ -540,17 +590,11 @@ retry: p.suite.Equal(decisionAttempt, lastDecisionScheduleEvent.DecisionTaskScheduledEventAttributes.GetAttempt()) } - if dropTask { - p.logger.Info("Dropping Decision task...") - return nil - } - - // process decision executionCtx, decisions, err := p.decisionHandler(response.WorkflowExecution, response.WorkflowType, common.Int64Default(response.PreviousStartedEventId), common.Int64Default(response.StartedEventId), response.History) if err != nil { p.logger.Infof("Failing Decision. Decision handler failed with error: %v", err) - return p.engine.RespondDecisionTaskFailed(createContext(), &workflow.RespondDecisionTaskFailedRequest{ + return isQueryTask, p.engine.RespondDecisionTaskFailed(createContext(), &workflow.RespondDecisionTaskFailedRequest{ TaskToken: response.TaskToken, Cause: common.DecisionTaskFailedCausePtr(workflow.DecisionTaskFailedCauseWorkflowWorkerUnhandledFailure), Details: []byte(err.Error()), @@ -559,92 +603,29 @@ retry: } p.logger.Infof("Completing Decision. Decisions: %v", decisions) - return p.engine.RespondDecisionTaskCompleted(createContext(), &workflow.RespondDecisionTaskCompletedRequest{ + if !respondStickyTaskList { + // non sticky tasklist + return false, p.engine.RespondDecisionTaskCompleted(createContext(), &workflow.RespondDecisionTaskCompletedRequest{ + TaskToken: response.TaskToken, + Identity: common.StringPtr(p.identity), + ExecutionContext: executionCtx, + Decisions: decisions, + }) + } + // sticky tasklist + return false, p.engine.RespondDecisionTaskCompleted(createContext(), &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: response.TaskToken, Identity: common.StringPtr(p.identity), ExecutionContext: executionCtx, Decisions: decisions, + StickyAttributes: &workflow.StickyExecutionAttributes{ + WorkerTaskList: p.sticktTaskList, + ScheduleToStartTimeoutSeconds: p.stickyScheduleToStartTimeoutSeconds, + }, }) } - return matching.ErrNoTasks -} - -func (p *taskPoller) pollAndProcessQueryTask(dumpHistory bool, dropTask bool) error { -retry: - for attempt := 0; attempt < 5; attempt++ { - response, err1 := p.engine.PollForDecisionTask(createContext(), &workflow.PollForDecisionTaskRequest{ - Domain: common.StringPtr(p.domain), - TaskList: p.taskList, - Identity: common.StringPtr(p.identity), - }) - - if err1 == history.ErrDuplicate { - p.logger.Info("Duplicate Decision task: Polling again.") - continue retry - } - - if err1 != nil { - return err1 - } - - if response == nil || len(response.TaskToken) == 0 { - p.logger.Info("Empty Decision task: Polling again.") - continue retry - } - - history := response.History - if history == nil { - p.logger.Fatal("History is nil") - } - - events := history.Events - if events == nil || len(events) == 0 { - p.logger.Fatalf("History Events are empty: %v", events) - } - - nextPageToken := response.NextPageToken - for nextPageToken != nil { - resp, err2 := p.engine.GetWorkflowExecutionHistory(createContext(), &workflow.GetWorkflowExecutionHistoryRequest{ - Domain: common.StringPtr(p.domain), - Execution: response.WorkflowExecution, - NextPageToken: nextPageToken, - }) - - if err2 != nil { - return err2 - } - - events = append(events, resp.History.Events...) - nextPageToken = resp.NextPageToken - } - - if dropTask { - p.logger.Info("Dropping Decision task: ") - return nil - } - - if dumpHistory { - common.PrettyPrintHistory(response.History, p.logger) - } - - blob, err := p.queryHandler(response) - - completeRequest := &workflow.RespondQueryTaskCompletedRequest{TaskToken: response.TaskToken} - if err != nil { - completeType := workflow.QueryTaskCompletedTypeFailed - completeRequest.CompletedType = &completeType - completeRequest.ErrorMessage = common.StringPtr(err.Error()) - } else { - completeType := workflow.QueryTaskCompletedTypeCompleted - completeRequest.CompletedType = &completeType - completeRequest.QueryResult = blob - } - - return p.engine.RespondQueryTaskCompleted(createContext(), completeRequest) - } - - return matching.ErrNoTasks + return false, matching.ErrNoTasks } func (p *taskPoller) pollAndProcessActivityTask(dropTask bool) error { @@ -796,9 +777,9 @@ func (s *integrationSuite) TestDecisionAndActivityTimeoutsWorkflow() { s.logger.Infof("Calling Decision Task: %d", i) var err error if dropDecisionTask { - err = poller.pollAndProcessDecisionTask(true, true) + _, err = poller.pollAndProcessDecisionTask(true, true) } else { - err = poller.pollAndProcessDecisionTaskWithAttempt(true, false, int64(1)) + _, err = poller.pollAndProcessDecisionTaskWithAttempt(true, false, false, false, int64(1)) } if err != nil { historyResponse, err := s.engine.GetWorkflowExecutionHistory(createContext(), &workflow.GetWorkflowExecutionHistoryRequest{ @@ -823,7 +804,8 @@ func (s *integrationSuite) TestDecisionAndActivityTimeoutsWorkflow() { s.logger.Infof("Waiting for workflow to complete: RunId: %v", *we.RunId) s.False(workflowComplete) - s.Nil(poller.pollAndProcessDecisionTask(true, false)) + _, err := poller.pollAndProcessDecisionTask(true, false) + s.Nil(err) s.True(workflowComplete) } @@ -921,7 +903,7 @@ func (s *integrationSuite) TestActivityHeartBeatWorkflow_Success() { suite: s, } - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.True(err == nil || err == matching.ErrNoTasks) err = poller.pollAndProcessActivityTask(false) @@ -930,7 +912,8 @@ func (s *integrationSuite) TestActivityHeartBeatWorkflow_Success() { s.logger.Infof("Waiting for workflow to complete: RunId: %v", *we.RunId) s.False(workflowComplete) - s.Nil(poller.pollAndProcessDecisionTask(true, false)) + _, err = poller.pollAndProcessDecisionTask(true, false) + s.Nil(err) s.True(workflowComplete) s.True(activityExecutedCount == 1) } @@ -1025,7 +1008,7 @@ func (s *integrationSuite) TestActivityHeartBeatWorkflow_Timeout() { suite: s, } - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.True(err == nil || err == matching.ErrNoTasks) err = poller.pollAndProcessActivityTask(false) @@ -1033,7 +1016,8 @@ func (s *integrationSuite) TestActivityHeartBeatWorkflow_Timeout() { s.logger.Infof("Waiting for workflow to complete: RunId: %v", *we.RunId) s.False(workflowComplete) - s.Nil(poller.pollAndProcessDecisionTask(true, false)) + _, err = poller.pollAndProcessDecisionTask(true, false) + s.Nil(err) s.True(workflowComplete) } @@ -1105,13 +1089,14 @@ func (s *integrationSuite) TestSequential_UserTimers() { } for i := 0; i < 4; i++ { - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Info("pollAndProcessDecisionTask: completed") s.Nil(err) } s.False(workflowComplete) - s.Nil(poller.pollAndProcessDecisionTask(true, false)) + _, err := poller.pollAndProcessDecisionTask(true, false) + s.Nil(err) s.True(workflowComplete) } @@ -1221,7 +1206,7 @@ func (s *integrationSuite) TestActivityCancelation() { suite: s, } - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.True(err == nil || err == matching.ErrNoTasks) cancelCh := make(chan struct{}) @@ -1230,7 +1215,7 @@ func (s *integrationSuite) TestActivityCancelation() { s.logger.Info("Trying to cancel the task in a different thread.") scheduleActivity = false requestCancellation = true - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.True(err == nil || err == matching.ErrNoTasks) cancelCh <- struct{}{} }() @@ -1350,7 +1335,7 @@ func (s *integrationSuite) TestSignalWorkflow() { } // Make first decision to schedule activity - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -1370,7 +1355,7 @@ func (s *integrationSuite) TestSignalWorkflow() { s.Nil(err) // Process signal in decider - err = poller.pollAndProcessDecisionTask(true, false) + _, err = poller.pollAndProcessDecisionTask(true, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -1395,7 +1380,7 @@ func (s *integrationSuite) TestSignalWorkflow() { s.Nil(err) // Process signal in decider - err = poller.pollAndProcessDecisionTask(true, false) + _, err = poller.pollAndProcessDecisionTask(true, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -1523,7 +1508,7 @@ func (s *integrationSuite) TestBufferedEvents() { } // first decision, which sends signal and the signal event should be buffered to append after first decision closed - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -1543,7 +1528,7 @@ func (s *integrationSuite) TestBufferedEvents() { s.Equal(histResp.History.Events[5].GetEventType(), workflow.EventTypeWorkflowExecutionSignaled) // Process signal in decider - err = poller.pollAndProcessDecisionTask(true, false) + _, err = poller.pollAndProcessDecisionTask(true, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) s.NotNil(signalEvent) @@ -1552,7 +1537,196 @@ func (s *integrationSuite) TestBufferedEvents() { s.True(workflowComplete) } -func (s *integrationSuite) TestQueryWorkflow() { +func (s *integrationSuite) TestQueryWorkflow_Sticky() { + fmt.Println("$$$$$$$$$$$$$$$$$$$$$$$$$$") + id := "interation-query-workflow-test" + wt := "interation-query-workflow-test-type" + tl := "interation-query-workflow-test-tasklist" + stl := "interation-query-workflow-test-tasklist-sticky" + identity := "worker1" + activityName := "activity_type1" + queryType := "test-query" + + workflowType := &workflow.WorkflowType{} + workflowType.Name = common.StringPtr(wt) + + taskList := &workflow.TaskList{} + taskList.Name = common.StringPtr(tl) + + stickyTaskList := &workflow.TaskList{} + stickyTaskList.Name = common.StringPtr(stl) + stickyScheduleToStartTimeoutSeconds := common.Int32Ptr(10) + + // Start workflow execution + request := &workflow.StartWorkflowExecutionRequest{ + RequestId: common.StringPtr(uuid.New()), + Domain: common.StringPtr(s.domainName), + WorkflowId: common.StringPtr(id), + WorkflowType: workflowType, + TaskList: taskList, + Input: nil, + ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(100), + TaskStartToCloseTimeoutSeconds: common.Int32Ptr(1), + Identity: common.StringPtr(identity), + } + + we, err0 := s.engine.StartWorkflowExecution(createContext(), request) + s.Nil(err0) + + s.logger.Infof("StartWorkflowExecution: response: %v \n", *we.RunId) + + // decider logic + workflowComplete := false + activityScheduled := false + activityData := int32(1) + var signalEvent *workflow.HistoryEvent + dtHandler := func(execution *workflow.WorkflowExecution, wt *workflow.WorkflowType, + previousStartedEventID, startedEventID int64, history *workflow.History) ([]byte, []*workflow.Decision, error) { + + if !activityScheduled { + activityScheduled = true + buf := new(bytes.Buffer) + s.Nil(binary.Write(buf, binary.LittleEndian, activityData)) + + return nil, []*workflow.Decision{{ + DecisionType: common.DecisionTypePtr(workflow.DecisionTypeScheduleActivityTask), + ScheduleActivityTaskDecisionAttributes: &workflow.ScheduleActivityTaskDecisionAttributes{ + ActivityId: common.StringPtr(strconv.Itoa(int(1))), + ActivityType: &workflow.ActivityType{Name: common.StringPtr(activityName)}, + TaskList: &workflow.TaskList{Name: &tl}, + Input: buf.Bytes(), + ScheduleToCloseTimeoutSeconds: common.Int32Ptr(100), + ScheduleToStartTimeoutSeconds: common.Int32Ptr(2), + StartToCloseTimeoutSeconds: common.Int32Ptr(50), + HeartbeatTimeoutSeconds: common.Int32Ptr(5), + }, + }}, nil + } else if previousStartedEventID > 0 { + for _, event := range history.Events[previousStartedEventID:] { + if *event.EventType == workflow.EventTypeWorkflowExecutionSignaled { + signalEvent = event + return nil, []*workflow.Decision{}, nil + } + } + } + + workflowComplete = true + return nil, []*workflow.Decision{{ + DecisionType: common.DecisionTypePtr(workflow.DecisionTypeCompleteWorkflowExecution), + CompleteWorkflowExecutionDecisionAttributes: &workflow.CompleteWorkflowExecutionDecisionAttributes{ + Result: []byte("Done."), + }, + }}, nil + } + + // activity handler + atHandler := func(execution *workflow.WorkflowExecution, activityType *workflow.ActivityType, + activityID string, input []byte, taskToken []byte) ([]byte, bool, error) { + + return []byte("Activity Result."), false, nil + } + + queryHandler := func(task *workflow.PollForDecisionTaskResponse) ([]byte, error) { + s.NotNil(task.Query) + s.NotNil(task.Query.QueryType) + if *task.Query.QueryType == queryType { + return []byte("query-result"), nil + } + + return nil, errors.New("unknown-query-type") + } + + poller := &taskPoller{ + engine: s.engine, + domain: s.domainName, + taskList: taskList, + identity: identity, + decisionHandler: dtHandler, + activityHandler: atHandler, + queryHandler: queryHandler, + logger: s.logger, + suite: s, + sticktTaskList: stickyTaskList, + stickyScheduleToStartTimeoutSeconds: stickyScheduleToStartTimeoutSeconds, + } + + // Make first decision to schedule activity + _, err := poller.pollAndProcessDecisionTaskWithAttempt(false, false, false, true, int64(0)) + s.logger.Infof("pollAndProcessDecisionTask: %v", err) + s.Nil(err) + + // hehe, _ := s.engine.DescribeWorkflowExecution(createContext(), &workflow.DescribeWorkflowExecutionRequest{ + // Domain: common.StringPtr(s.domainName), + // Execution: &workflow.WorkflowExecution{ + // WorkflowId: common.StringPtr(id), + // RunId: common.StringPtr(*we.RunId), + // }, + // }) + // fmt.Println("*************") + // fmt.Println(hehe.ExecutionConfiguration.StickyTaskList) + // fmt.Println("*************") + + type QueryResult struct { + Resp *workflow.QueryWorkflowResponse + Err error + } + queryResultCh := make(chan QueryResult) + queryWorkflowFn := func(queryType string) { + queryResp, err := s.engine.QueryWorkflow(createContext(), &workflow.QueryWorkflowRequest{ + Domain: common.StringPtr(s.domainName), + Execution: &workflow.WorkflowExecution{ + WorkflowId: common.StringPtr(id), + RunId: common.StringPtr(*we.RunId), + }, + Query: &workflow.WorkflowQuery{ + QueryType: common.StringPtr(queryType), + }, + }) + queryResultCh <- QueryResult{Resp: queryResp, Err: err} + } + + // call QueryWorkflow in separate goroutinue (because it is blocking). That will generate a query task + go queryWorkflowFn(queryType) + // process that query task, which should respond via RespondQueryTaskCompleted + for { + // loop until process the query task + fmt.Println("looping s") + isQueryTask, errInner := poller.pollAndProcessDecisionTaskWithSticky(false, false) + s.logger.Infof("pollAndProcessDecisionTask: %v", err) + s.Nil(errInner) + fmt.Println("isQueryTask") + fmt.Println(isQueryTask) + fmt.Println("looping e") + if isQueryTask { + break + } + } + // wait until query result is ready + queryResult := <-queryResultCh + s.NoError(queryResult.Err) + s.NotNil(queryResult.Resp) + s.NotNil(queryResult.Resp.QueryResult) + queryResultString := string(queryResult.Resp.QueryResult) + s.Equal("query-result", queryResultString) + + go queryWorkflowFn("invalid-query-type") + for { + // loop until process the query task + isQueryTask, errInner := poller.pollAndProcessDecisionTaskWithSticky(false, false) + s.logger.Infof("pollAndProcessDecisionTask: %v", err) + s.Nil(errInner) + if isQueryTask { + break + } + } + queryResult = <-queryResultCh + s.NotNil(queryResult.Err) + queryFailError, ok := queryResult.Err.(*workflow.QueryFailedError) + s.True(ok) + s.Equal("unknown-query-type", queryFailError.Message) +} + +func (s *integrationSuite) TestQueryWorkflow_NonSticky() { id := "interation-query-workflow-test" wt := "interation-query-workflow-test-type" tl := "interation-query-workflow-test-tasklist" @@ -1658,7 +1832,7 @@ func (s *integrationSuite) TestQueryWorkflow() { } // Make first decision to schedule activity - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -1684,8 +1858,15 @@ func (s *integrationSuite) TestQueryWorkflow() { // call QueryWorkflow in separate goroutinue (because it is blocking). That will generate a query task go queryWorkflowFn(queryType) // process that query task, which should respond via RespondQueryTaskCompleted - err = poller.pollAndProcessQueryTask(false, false) - // wait until query result is ready + for { + // loop until process the query task + isQueryTask, errInner := poller.pollAndProcessDecisionTask(false, false) + s.logger.Infof("pollAndProcessDecisionTask: %v", err) + s.Nil(errInner) + if isQueryTask { + break + } + } // wait until query result is ready queryResult := <-queryResultCh s.NoError(queryResult.Err) s.NotNil(queryResult.Resp) @@ -1694,15 +1875,28 @@ func (s *integrationSuite) TestQueryWorkflow() { s.Equal("query-result", queryResultString) go queryWorkflowFn("invalid-query-type") - err = poller.pollAndProcessQueryTask(false, false) + for { + // loop until process the query task + isQueryTask, errInner := poller.pollAndProcessDecisionTask(false, false) + s.logger.Infof("pollAndProcessDecisionTask: %v", err) + s.Nil(errInner) + if isQueryTask { + break + } + } queryResult = <-queryResultCh s.NotNil(queryResult.Err) queryFailError, ok := queryResult.Err.(*workflow.QueryFailedError) s.True(ok) s.Equal("unknown-query-type", queryFailError.Message) + fmt.Println("$$$$$$$$$$$$$$$$$$$$$$$$$$") +} + +func (s *integrationSuite) TestDescribeWorkflowExecution_Sticky() { + // TODO } -func (s *integrationSuite) TestDescribeWorkflowExecution() { +func (s *integrationSuite) TestDescribeWorkflowExecution_NonSticky() { id := "interation-describe-wfe-test" wt := "interation-describe-wfe-test-type" tl := "interation-describe-wfe-test-tasklist" @@ -1795,7 +1989,7 @@ func (s *integrationSuite) TestDescribeWorkflowExecution() { } // first decision to schedule new activity - err = poller.pollAndProcessDecisionTask(false, false) + _, err = poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -1822,7 +2016,7 @@ func (s *integrationSuite) TestDescribeWorkflowExecution() { s.Equal(int64(7), *dweResponse.WorkflowExecutionInfo.HistoryLength) // Signaled, DecisionTaskScheduled // Process signal in decider - err = poller.pollAndProcessDecisionTask(true, false) + _, err = poller.pollAndProcessDecisionTask(true, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) s.NotNil(signalEvent) @@ -1905,13 +2099,14 @@ func (s *integrationSuite) TestContinueAsNewWorkflow() { } for i := 0; i < 10; i++ { - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err, strconv.Itoa(i)) } s.False(workflowComplete) - s.Nil(poller.pollAndProcessDecisionTask(true, false)) + _, err := poller.pollAndProcessDecisionTask(true, false) + s.Nil(err) s.True(workflowComplete) } @@ -1983,7 +2178,7 @@ func (s *integrationSuite) TestVisibility() { suite: s, } - err2 := poller.pollAndProcessDecisionTask(false, false) + _, err2 := poller.pollAndProcessDecisionTask(false, false) s.Nil(err2) startFilter := &workflow.StartTimeFilter{} @@ -2110,7 +2305,7 @@ func (s *integrationSuite) TestExternalRequestCancelWorkflowExecution() { suite: s, } - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -2137,7 +2332,7 @@ func (s *integrationSuite) TestExternalRequestCancelWorkflowExecution() { s.NotNil(err) s.IsType(&workflow.CancellationAlreadyRequestedError{}, err) - err = poller.pollAndProcessDecisionTask(true, false) + _, err = poller.pollAndProcessDecisionTask(true, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -2309,11 +2504,11 @@ func (s *integrationSuite) TestRequestCancelWorkflowDecisionExecution() { } // Start both current and foreign workflows to make some progress. - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) - err = foreignPoller.pollAndProcessDecisionTask(false, false) + _, err = foreignPoller.pollAndProcessDecisionTask(false, false) s.logger.Infof("foreign pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -2322,7 +2517,7 @@ func (s *integrationSuite) TestRequestCancelWorkflowDecisionExecution() { s.Nil(err) // Cancel the foreign workflow with this decision request. - err = poller.pollAndProcessDecisionTask(true, false) + _, err = poller.pollAndProcessDecisionTask(true, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -2360,7 +2555,7 @@ CheckHistoryLoopForCancelSent: s.True(cancellationSent) // Accept cancellation. - err = foreignPoller.pollAndProcessDecisionTask(false, false) + _, err = foreignPoller.pollAndProcessDecisionTask(false, false) s.logger.Infof("foreign pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -2487,12 +2682,12 @@ func (s *integrationSuite) TestRequestCancelWorkflowDecisionExecution_UnKnownTar } // Start both current and foreign workflows to make some progress. - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) // Cancel the foreign workflow with this decision request. - err = poller.pollAndProcessDecisionTask(true, false) + _, err = poller.pollAndProcessDecisionTask(true, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -2640,9 +2835,9 @@ func (s *integrationSuite) TestHistoryVersionCompatibilityCheck() { s.logger.Infof("Calling Decision Task: %d", i) var err error if decisionFailed { - err = poller.pollAndProcessDecisionTaskWithAttempt(false, false, int64(1)) + _, err = poller.pollAndProcessDecisionTaskWithAttempt(false, false, false, false, int64(1)) } else { - err = poller.pollAndProcessDecisionTask(false, false) + _, err = poller.pollAndProcessDecisionTask(false, false) } if i == testDecisionPollFailStep { @@ -2674,7 +2869,8 @@ func (s *integrationSuite) TestHistoryVersionCompatibilityCheck() { s.logger.Infof("Waiting for workflow to complete: RunId: %v", *we.RunId) s.False(workflowComplete) - s.Nil(poller.pollAndProcessDecisionTask(true, false)) + _, err := poller.pollAndProcessDecisionTask(true, false) + s.Nil(err) s.True(workflowComplete) } @@ -2806,25 +3002,23 @@ func (s *integrationSuite) TestChildWorkflowExecution() { } // Make first decision to start child execution - err := pollerParent.pollAndProcessDecisionTask(false, false) + _, err := pollerParent.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) s.True(childExecutionStarted) - // Process ChildExecution Started event - err = pollerParent.pollAndProcessDecisionTask(false, false) + // Process ChildExecution Started event and Process Child Execution and complete it + _, err = pollerParent.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) - - // Process Child Execution and complete it - err = pollerChild.pollAndProcessDecisionTask(false, false) + _, err = pollerChild.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) s.NotNil(startedEvent) s.True(childComplete) // Process ChildExecution completed event and complete parent execution - err = pollerParent.pollAndProcessDecisionTask(false, false) + _, err = pollerParent.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) s.NotNil(completedEvent) @@ -2976,14 +3170,14 @@ func (s *integrationSuite) TestChildWorkflowWithContinueAsNew() { } // Make first decision to start child execution - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) s.True(childExecutionStarted) // Process ChildExecution Started event and all generations of child executions for i := 0; i < 11; i++ { - err = poller.pollAndProcessDecisionTask(false, false) + _, err = poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) } @@ -2992,13 +3186,13 @@ func (s *integrationSuite) TestChildWorkflowWithContinueAsNew() { s.NotNil(startedEvent) // Process Child Execution final decision to complete it - err = poller.pollAndProcessDecisionTask(false, false) + _, err = poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) s.True(childComplete) // Process ChildExecution completed event and complete parent execution - err = poller.pollAndProcessDecisionTask(false, false) + _, err = poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) s.NotNil(completedEvent) @@ -3221,7 +3415,7 @@ func (s *integrationSuite) TestDecisionTaskFailed() { } // Make first decision to schedule activity - err := poller.pollAndProcessDecisionTask(false, false) + _, err := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) @@ -3232,7 +3426,7 @@ func (s *integrationSuite) TestDecisionTaskFailed() { // fail decision 5 times for i := 0; i < 5; i++ { - err := poller.pollAndProcessDecisionTaskWithAttempt(false, false, int64(i)) + _, err := poller.pollAndProcessDecisionTaskWithAttempt(false, false, false, false, int64(i)) s.Nil(err) } @@ -3240,7 +3434,7 @@ func (s *integrationSuite) TestDecisionTaskFailed() { s.Nil(err, "failed to send signal to execution") // process signal - err = poller.pollAndProcessDecisionTask(true, false) + _, err = poller.pollAndProcessDecisionTask(true, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) s.Equal(1, signalCount) @@ -3251,26 +3445,26 @@ func (s *integrationSuite) TestDecisionTaskFailed() { // fail decision 2 more times for i := 0; i < 2; i++ { - err := poller.pollAndProcessDecisionTaskWithAttempt(false, false, int64(i)) + _, err := poller.pollAndProcessDecisionTaskWithAttempt(false, false, false, false, int64(i)) s.Nil(err) } s.Equal(3, signalCount) // now send a signal during failed decision sendSignal = true - err = poller.pollAndProcessDecisionTaskWithAttempt(false, false, int64(2)) + _, err = poller.pollAndProcessDecisionTaskWithAttempt(false, false, false, false, int64(2)) s.Nil(err) s.Equal(4, signalCount) // fail decision 1 more times for i := 0; i < 2; i++ { - err := poller.pollAndProcessDecisionTaskWithAttempt(false, false, 3+int64(i)) + _, err := poller.pollAndProcessDecisionTaskWithAttempt(false, false, false, false, 3+int64(i)) s.Nil(err) } s.Equal(12, signalCount) // Make complete workflow decision - err = poller.pollAndProcessDecisionTaskWithAttempt(true, false, int64(5)) + _, err = poller.pollAndProcessDecisionTaskWithAttempt(true, false, false, false, int64(5)) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) s.True(workflowComplete) @@ -3402,7 +3596,7 @@ func (s *integrationSuite) TestGetWorkflowExecutionHistoryLongPoll() { // here do a long pull and check # of events and time elapsed // make first decision to schedule activity, this should affect the long poll above time.AfterFunc(time.Second*8, func() { - errDecision1 := poller.pollAndProcessDecisionTask(false, false) + _, errDecision1 := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", errDecision1) }) start = time.Now() @@ -3418,7 +3612,7 @@ func (s *integrationSuite) TestGetWorkflowExecutionHistoryLongPoll() { s.logger.Infof("pollAndProcessDecisionTask: %v", errActivity) }) time.AfterFunc(time.Second*8, func() { - errDecision2 := poller.pollAndProcessDecisionTask(false, false) + _, errDecision2 := poller.pollAndProcessDecisionTask(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", errDecision2) }) for token != nil { diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index 1ad16428455..cf8e53ec96e 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -202,6 +202,8 @@ struct WorkflowExecutionConfiguration { 20: optional i32 executionStartToCloseTimeoutSeconds 30: optional i32 taskStartToCloseTimeoutSeconds 40: optional ChildPolicy childPolicy + 50: optional TaskList stickyTaskList + 60: optional i32 stickyScheduleToStartTimeoutSeconds } struct TransientDecisionInfo { diff --git a/service/frontend/handler.go b/service/frontend/handler.go index c94e308180b..79f0d185b55 100644 --- a/service/frontend/handler.go +++ b/service/frontend/handler.go @@ -23,7 +23,6 @@ package frontend import ( "context" "encoding/json" - "errors" "sync" "github.com/pborman/uuid" @@ -390,50 +389,11 @@ func (wh *WorkflowHandler) PollForDecisionTask( return nil, nil } - var history *gen.History - var persistenceToken []byte - var continuation []byte - if matchingResp.WorkflowExecution != nil { - // Non-empty response. Get the history - nextEventID := matchingResp.GetNextEventId() - firstEventID := common.FirstEventID - if matchingResp.GetStickyExecutionEnabled() { - firstEventID = matchingResp.GetPreviousStartedEventId() + 1 - } - history, persistenceToken, err = wh.getHistory( - info.ID, - *matchingResp.WorkflowExecution, - firstEventID, - nextEventID, - wh.config.DefaultHistoryMaxPageSize, - nil, - matchingResp.DecisionInfo) - if err != nil { - return nil, wh.error(err, scope) - } - - if matchingResp.WorkflowExecution.RunId == nil { - wh.Service.GetLogger().Errorf( - "PollForDecisionTask from matching engine doesn't have run id. TaskList: %v", - *pollRequest.TaskList.Name) - return nil, wh.error(errRunIDNotSet, scope) - } - - if len(persistenceToken) != 0 { - continuation, err = serializeHistoryToken(&getHistoryContinuationToken{ - RunID: *matchingResp.WorkflowExecution.RunId, - FirstEventID: firstEventID, - NextEventID: nextEventID, - PersistenceToken: persistenceToken, - TransientDecision: matchingResp.DecisionInfo, - }) - if err != nil { - return nil, wh.error(err, scope) - } - } + resp, err := wh.createPollForDecisionTaskResponse(ctx, info.ID, matchingResp) + if err != nil { + return nil, wh.error(err, scope) } - - return wh.createPollForDecisionTaskResponse(ctx, matchingResp, history, continuation), nil + return resp, nil } func (wh *WorkflowHandler) cancelOutstandingPoll(ctx context.Context, err error, domainID string, taskListType int32, @@ -1388,30 +1348,26 @@ func (wh *WorkflowHandler) QueryWorkflow(ctx context.Context, DomainUUID: common.StringPtr(domainInfo.ID), QueryRequest: queryRequest, } - if queryRequest.Execution.RunId == nil { - // RunID is not set, we would use the running one if it exists. - response, err := wh.history.GetWorkflowExecutionNextEventID(ctx, &h.GetWorkflowExecutionNextEventIDRequest{ + + // we should always use the mutable state, since it contains the sticky tasklist information + response, err := wh.history.DescribeWorkflowExecution( + ctx, + &h.DescribeWorkflowExecutionRequest{ DomainUUID: common.StringPtr(domainInfo.ID), - Execution: queryRequest.Execution, + Request: &gen.DescribeWorkflowExecutionRequest{ + Domain: queryRequest.Domain, + Execution: queryRequest.Execution, + }, }) - if err != nil { - return nil, wh.error(err, scope) - } + if err != nil { + return nil, wh.error(err, scope) + } - queryRequest.Execution.RunId = response.RunId - matchingRequest.TaskList = response.Tasklist + queryRequest.Execution.RunId = response.WorkflowExecutionInfo.Execution.RunId + if response.ExecutionConfiguration.StickyTaskList == nil || len(response.ExecutionConfiguration.StickyTaskList.GetName()) == 0 { + matchingRequest.TaskList = response.ExecutionConfiguration.TaskList } else { - // Get the TaskList from history (first event) - history, _, err := wh.getHistory(domainInfo.ID, *queryRequest.Execution, common.FirstEventID, common.FirstEventID+1, - 1, nil, nil) - if err != nil { - return nil, wh.error(err, scope) - } - if len(history.Events) == 0 || history.Events[0].GetEventType() != gen.EventTypeWorkflowExecutionStarted { - // this should not happen - return nil, wh.error(errors.New("invalid history events"), scope) - } - matchingRequest.TaskList = history.Events[0].WorkflowExecutionStartedEventAttributes.TaskList + matchingRequest.TaskList = response.ExecutionConfiguration.StickyTaskList } matchingResp, err := wh.matching.QueryWorkflow(ctx, matchingRequest) @@ -1619,54 +1575,78 @@ func createDomainResponse(info *persistence.DomainInfo, config *persistence.Doma return i, c } -func (wh *WorkflowHandler) createPollForDecisionTaskResponse(ctx context.Context, - matchingResponse *m.PollForDecisionTaskResponse, history *gen.History, nextPageToken []byte) *gen.PollForDecisionTaskResponse { - resp := &gen.PollForDecisionTaskResponse{} - if matchingResponse != nil { - resp.TaskToken = matchingResponse.TaskToken - resp.WorkflowExecution = matchingResponse.WorkflowExecution - resp.WorkflowType = matchingResponse.WorkflowType - resp.PreviousStartedEventId = matchingResponse.PreviousStartedEventId - resp.StartedEventId = matchingResponse.StartedEventId - resp.Query = matchingResponse.Query - resp.BacklogCountHint = matchingResponse.BacklogCountHint - } - - if matchingResponse.Query != nil && resp.WorkflowType == nil { - // for query task, the matching engine was not able to populate the WorkflowType, so set here from history - if history != nil && len(history.Events) > 0 && - history.Events[0].WorkflowExecutionStartedEventAttributes != nil { - resp.WorkflowType = history.Events[0].WorkflowExecutionStartedEventAttributes.WorkflowType - } else { - // this should never happen, but if it does happen, log it and respond error back to query client. - logging.LogQueryTaskMissingWorkflowTypeErrorEvent(wh.GetLogger(), - *matchingResponse.WorkflowExecution.WorkflowId, - *matchingResponse.WorkflowExecution.RunId, - *resp.Query.QueryType) - - queryTaskToken, err := wh.tokenSerializer.DeserializeQueryTaskToken(matchingResponse.TaskToken) - if err == nil { - completeType := gen.QueryTaskCompletedTypeFailed - wh.matching.RespondQueryTaskCompleted(ctx, &m.RespondQueryTaskCompletedRequest{ - DomainUUID: common.StringPtr(queryTaskToken.DomainID), - TaskList: &gen.TaskList{Name: common.StringPtr(queryTaskToken.TaskList)}, - TaskID: common.StringPtr(queryTaskToken.TaskID), - CompletedRequest: &gen.RespondQueryTaskCompletedRequest{ - TaskToken: matchingResponse.TaskToken, - CompletedType: &completeType, - ErrorMessage: common.StringPtr("server internal error: cannot get WorkflowType for QueryTask"), - }, - }) - } +func (wh *WorkflowHandler) createPollForDecisionTaskResponse(ctx context.Context, domainID string, + matchingResp *m.PollForDecisionTaskResponse) (*gen.PollForDecisionTaskResponse, error) { + + if matchingResp.WorkflowExecution == nil { + // this will happen if there is no decision task to be send to worker / caller + return &gen.PollForDecisionTaskResponse{}, nil + } - // in this case, just return empty response for the pool request and client will just ignore - return &gen.PollForDecisionTaskResponse{} + var history *gen.History + var continuation []byte + var err error + + if matchingResp.GetStickyExecutionEnabled() && matchingResp.Query != nil { + // meaning sticky query, we should not return any events to worker + // since query task only check the current status + history = &gen.History{ + Events: []*gen.HistoryEvent{}, + } + } else { + // here we have 3 cases: + // 1. sticky && non query task + // 2. non sticky && non query task + // 3. non sticky && query task + // for 1, partial history have to be send back + // for 2 and 3, full history have to be send back + + var persistenceToken []byte + + firstEventID := common.FirstEventID + nextEventID := matchingResp.GetNextEventId() + if matchingResp.GetStickyExecutionEnabled() { + firstEventID = matchingResp.GetPreviousStartedEventId() + 1 + } + history, persistenceToken, err = wh.getHistory( + domainID, + *matchingResp.WorkflowExecution, + firstEventID, + nextEventID, + wh.config.DefaultHistoryMaxPageSize, + nil, + matchingResp.DecisionInfo) + if err != nil { + return nil, err + } + + if len(persistenceToken) != 0 { + continuation, err = serializeHistoryToken(&getHistoryContinuationToken{ + RunID: *matchingResp.WorkflowExecution.RunId, + FirstEventID: firstEventID, + NextEventID: nextEventID, + PersistenceToken: persistenceToken, + TransientDecision: matchingResp.DecisionInfo, + }) + if err != nil { + return nil, err + } } } - resp.History = history - resp.NextPageToken = nextPageToken - return resp + resp := &gen.PollForDecisionTaskResponse{ + TaskToken: matchingResp.TaskToken, + WorkflowExecution: matchingResp.WorkflowExecution, + WorkflowType: matchingResp.WorkflowType, + PreviousStartedEventId: matchingResp.PreviousStartedEventId, + StartedEventId: matchingResp.StartedEventId, + Query: matchingResp.Query, + BacklogCountHint: matchingResp.BacklogCountHint, + History: history, + NextPageToken: continuation, + } + + return resp, nil } func createGetWorkflowExecutionHistoryResponse( diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index cd6d847ddc6..2cf9e612b24 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -402,6 +402,8 @@ func (e *historyEngineImpl) DescribeWorkflowExecution( ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(msBuilder.executionInfo.WorkflowTimeout), TaskStartToCloseTimeoutSeconds: common.Int32Ptr(msBuilder.executionInfo.DecisionTimeoutValue), ChildPolicy: common.ChildPolicyPtr(workflow.ChildPolicyTerminate), + StickyTaskList: &workflow.TaskList{Name: common.StringPtr(msBuilder.executionInfo.StickyTaskList)}, + StickyScheduleToStartTimeoutSeconds: common.Int32Ptr(msBuilder.executionInfo.StickyScheduleToStartTimeout), }, WorkflowExecutionInfo: &workflow.WorkflowExecutionInfo{ Execution: request.Request.Execution, @@ -1040,7 +1042,6 @@ Update_History_Loop: // Inform timer about the new ones. e.timerProcessor.NotifyNewTimer(timerTasks) - return err } diff --git a/service/matching/matchingEngine.go b/service/matching/matchingEngine.go index f042b222cec..5d51afb4d2e 100644 --- a/service/matching/matchingEngine.go +++ b/service/matching/matchingEngine.go @@ -258,9 +258,12 @@ pollLoop: if tCtx.queryTaskInfo != nil { // for query task, we don't need to update history to record decision task started. but we need to know // the NextEventID so front end knows what are the history events to load for this decision task. - nextIDResp, err := e.historyService.GetWorkflowExecutionNextEventID(ctx, &h.GetWorkflowExecutionNextEventIDRequest{ + describeResp, err := e.historyService.DescribeWorkflowExecution(ctx, &h.DescribeWorkflowExecutionRequest{ DomainUUID: req.DomainUUID, - Execution: &tCtx.workflowExecution, + Request: &workflow.DescribeWorkflowExecutionRequest{ + Domain: req.PollRequest.Domain, + Execution: &tCtx.workflowExecution, + }, }) if err != nil { // will notify query client that the query task failed @@ -275,9 +278,15 @@ pollLoop: return emptyPollForDecisionTaskResponse, nil } + isStickyEnabled := false + if describeResp.ExecutionConfiguration.StickyTaskList != nil && len(describeResp.ExecutionConfiguration.StickyTaskList.GetName()) != 0 { + isStickyEnabled = true + } resp := &h.RecordDecisionTaskStartedResponse{ - PreviousStartedEventId: nextIDResp.EventId, - NextEventId: nextIDResp.EventId, + PreviousStartedEventId: describeResp.WorkflowExecutionInfo.HistoryLength, + NextEventId: describeResp.WorkflowExecutionInfo.HistoryLength, + WorkflowType: describeResp.WorkflowExecutionInfo.Type, + StickyExecutionEnabled: common.BoolPtr(isStickyEnabled), } tCtx.completeTask(nil) return e.createPollForDecisionTaskResponse(tCtx, resp), nil @@ -483,11 +492,11 @@ func (e *matchingEngineImpl) createPollForDecisionTaskResponse(context *taskCont ScheduleAttempt: historyResponse.GetAttempt(), } response.TaskToken, _ = e.tokenSerializer.Serialize(token) - response.WorkflowType = historyResponse.WorkflowType } if historyResponse.GetPreviousStartedEventId() != common.EmptyEventID { response.PreviousStartedEventId = historyResponse.PreviousStartedEventId } + response.WorkflowType = historyResponse.WorkflowType response.StartedEventId = historyResponse.StartedEventId response.StickyExecutionEnabled = historyResponse.StickyExecutionEnabled response.BacklogCountHint = common.Int64Ptr(context.backlogCountHint) From ec85132d951ea369c75f452023df4bb23de34111 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Wed, 13 Dec 2017 10:47:10 -0800 Subject: [PATCH 2/5] add field in QueryWorkflowRequest, specifying whether to use sticky tasklist for query --- .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 46 +++- host/integration_test.go | 306 ++++++++++++++++++++-- idl/github.com/uber/cadence/shared.thrift | 1 + service/frontend/handler.go | 8 + 5 files changed, 340 insertions(+), 25 deletions(-) diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index 4c3ec8da04e..8b5acc38d9b 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "0da8f44f08f449b9155322473141320082b109e2", + SHA1: "876b2284c4024afe2e1246d330ed055cf1ec7c7b", Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n 50: optional TaskList stickyTaskList\n 60: optional i32 stickyScheduleToStartTimeoutSeconds\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional string identity\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n 50: optional TaskList stickyTaskList\n 60: optional i32 stickyScheduleToStartTimeoutSeconds\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional string identity\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n 40: optional bool isStickyQuery\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index c9b2153b424..9642db9c198 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -13312,9 +13312,10 @@ func (v *QueryTaskCompletedType) UnmarshalJSON(text []byte) error { } type QueryWorkflowRequest struct { - Domain *string `json:"domain,omitempty"` - Execution *WorkflowExecution `json:"execution,omitempty"` - Query *WorkflowQuery `json:"query,omitempty"` + Domain *string `json:"domain,omitempty"` + Execution *WorkflowExecution `json:"execution,omitempty"` + Query *WorkflowQuery `json:"query,omitempty"` + IsStickyQuery *bool `json:"isStickyQuery,omitempty"` } // ToWire translates a QueryWorkflowRequest struct into a Thrift-level intermediate @@ -13334,7 +13335,7 @@ type QueryWorkflowRequest struct { // } func (v *QueryWorkflowRequest) ToWire() (wire.Value, error) { var ( - fields [3]wire.Field + fields [4]wire.Field i int = 0 w wire.Value err error @@ -13364,6 +13365,14 @@ func (v *QueryWorkflowRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 30, Value: w} i++ } + if v.IsStickyQuery != nil { + w, err = wire.NewValueBool(*(v.IsStickyQuery)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 40, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -13415,6 +13424,16 @@ func (v *QueryWorkflowRequest) FromWire(w wire.Value) error { return err } + } + case 40: + if field.Value.Type() == wire.TBool { + var x bool + x, err = field.Value.GetBool(), error(nil) + v.IsStickyQuery = &x + if err != nil { + return err + } + } } } @@ -13429,7 +13448,7 @@ func (v *QueryWorkflowRequest) String() string { return "" } - var fields [3]string + var fields [4]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -13443,6 +13462,10 @@ func (v *QueryWorkflowRequest) String() string { fields[i] = fmt.Sprintf("Query: %v", v.Query) i++ } + if v.IsStickyQuery != nil { + fields[i] = fmt.Sprintf("IsStickyQuery: %v", *(v.IsStickyQuery)) + i++ + } return fmt.Sprintf("QueryWorkflowRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -13461,6 +13484,9 @@ func (v *QueryWorkflowRequest) Equals(rhs *QueryWorkflowRequest) bool { if !((v.Query == nil && rhs.Query == nil) || (v.Query != nil && rhs.Query != nil && v.Query.Equals(rhs.Query))) { return false } + if !_Bool_EqualsPtr(v.IsStickyQuery, rhs.IsStickyQuery) { + return false + } return true } @@ -13475,6 +13501,16 @@ func (v *QueryWorkflowRequest) GetDomain() (o string) { return } +// GetIsStickyQuery returns the value of IsStickyQuery if it is set or its +// zero value if it is unset. +func (v *QueryWorkflowRequest) GetIsStickyQuery() (o bool) { + if v.IsStickyQuery != nil { + return *v.IsStickyQuery + } + + return +} + type QueryWorkflowResponse struct { QueryResult []byte `json:"queryResult,omitempty"` } diff --git a/host/integration_test.go b/host/integration_test.go index bbc0b812724..c2733c3c5f0 100644 --- a/host/integration_test.go +++ b/host/integration_test.go @@ -1538,7 +1538,6 @@ func (s *integrationSuite) TestBufferedEvents() { } func (s *integrationSuite) TestQueryWorkflow_Sticky() { - fmt.Println("$$$$$$$$$$$$$$$$$$$$$$$$$$") id := "interation-query-workflow-test" wt := "interation-query-workflow-test-type" tl := "interation-query-workflow-test-tasklist" @@ -1655,17 +1654,6 @@ func (s *integrationSuite) TestQueryWorkflow_Sticky() { s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(err) - // hehe, _ := s.engine.DescribeWorkflowExecution(createContext(), &workflow.DescribeWorkflowExecutionRequest{ - // Domain: common.StringPtr(s.domainName), - // Execution: &workflow.WorkflowExecution{ - // WorkflowId: common.StringPtr(id), - // RunId: common.StringPtr(*we.RunId), - // }, - // }) - // fmt.Println("*************") - // fmt.Println(hehe.ExecutionConfiguration.StickyTaskList) - // fmt.Println("*************") - type QueryResult struct { Resp *workflow.QueryWorkflowResponse Err error @@ -1681,6 +1669,7 @@ func (s *integrationSuite) TestQueryWorkflow_Sticky() { Query: &workflow.WorkflowQuery{ QueryType: common.StringPtr(queryType), }, + IsStickyQuery: common.BoolPtr(true), }) queryResultCh <- QueryResult{Resp: queryResp, Err: err} } @@ -1690,13 +1679,9 @@ func (s *integrationSuite) TestQueryWorkflow_Sticky() { // process that query task, which should respond via RespondQueryTaskCompleted for { // loop until process the query task - fmt.Println("looping s") isQueryTask, errInner := poller.pollAndProcessDecisionTaskWithSticky(false, false) s.logger.Infof("pollAndProcessDecisionTask: %v", err) s.Nil(errInner) - fmt.Println("isQueryTask") - fmt.Println(isQueryTask) - fmt.Println("looping e") if isQueryTask { break } @@ -1726,6 +1711,178 @@ func (s *integrationSuite) TestQueryWorkflow_Sticky() { s.Equal("unknown-query-type", queryFailError.Message) } +func (s *integrationSuite) TestQueryWorkflow_Sticky_UseNonSticky() { + id := "interation-query-workflow-test" + wt := "interation-query-workflow-test-type" + tl := "interation-query-workflow-test-tasklist" + stl := "interation-query-workflow-test-tasklist-sticky" + identity := "worker1" + activityName := "activity_type1" + queryType := "test-query" + + workflowType := &workflow.WorkflowType{} + workflowType.Name = common.StringPtr(wt) + + taskList := &workflow.TaskList{} + taskList.Name = common.StringPtr(tl) + + stickyTaskList := &workflow.TaskList{} + stickyTaskList.Name = common.StringPtr(stl) + stickyScheduleToStartTimeoutSeconds := common.Int32Ptr(10) + + // Start workflow execution + request := &workflow.StartWorkflowExecutionRequest{ + RequestId: common.StringPtr(uuid.New()), + Domain: common.StringPtr(s.domainName), + WorkflowId: common.StringPtr(id), + WorkflowType: workflowType, + TaskList: taskList, + Input: nil, + ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(100), + TaskStartToCloseTimeoutSeconds: common.Int32Ptr(1), + Identity: common.StringPtr(identity), + } + + we, err0 := s.engine.StartWorkflowExecution(createContext(), request) + s.Nil(err0) + + s.logger.Infof("StartWorkflowExecution: response: %v \n", *we.RunId) + + // decider logic + workflowComplete := false + activityScheduled := false + activityData := int32(1) + var signalEvent *workflow.HistoryEvent + dtHandler := func(execution *workflow.WorkflowExecution, wt *workflow.WorkflowType, + previousStartedEventID, startedEventID int64, history *workflow.History) ([]byte, []*workflow.Decision, error) { + + if !activityScheduled { + activityScheduled = true + buf := new(bytes.Buffer) + s.Nil(binary.Write(buf, binary.LittleEndian, activityData)) + + return nil, []*workflow.Decision{{ + DecisionType: common.DecisionTypePtr(workflow.DecisionTypeScheduleActivityTask), + ScheduleActivityTaskDecisionAttributes: &workflow.ScheduleActivityTaskDecisionAttributes{ + ActivityId: common.StringPtr(strconv.Itoa(int(1))), + ActivityType: &workflow.ActivityType{Name: common.StringPtr(activityName)}, + TaskList: &workflow.TaskList{Name: &tl}, + Input: buf.Bytes(), + ScheduleToCloseTimeoutSeconds: common.Int32Ptr(100), + ScheduleToStartTimeoutSeconds: common.Int32Ptr(2), + StartToCloseTimeoutSeconds: common.Int32Ptr(50), + HeartbeatTimeoutSeconds: common.Int32Ptr(5), + }, + }}, nil + } else if previousStartedEventID > 0 { + for _, event := range history.Events[previousStartedEventID:] { + if *event.EventType == workflow.EventTypeWorkflowExecutionSignaled { + signalEvent = event + return nil, []*workflow.Decision{}, nil + } + } + } + + workflowComplete = true + return nil, []*workflow.Decision{{ + DecisionType: common.DecisionTypePtr(workflow.DecisionTypeCompleteWorkflowExecution), + CompleteWorkflowExecutionDecisionAttributes: &workflow.CompleteWorkflowExecutionDecisionAttributes{ + Result: []byte("Done."), + }, + }}, nil + } + + // activity handler + atHandler := func(execution *workflow.WorkflowExecution, activityType *workflow.ActivityType, + activityID string, input []byte, taskToken []byte) ([]byte, bool, error) { + + return []byte("Activity Result."), false, nil + } + + queryHandler := func(task *workflow.PollForDecisionTaskResponse) ([]byte, error) { + s.NotNil(task.Query) + s.NotNil(task.Query.QueryType) + if *task.Query.QueryType == queryType { + return []byte("query-result"), nil + } + + return nil, errors.New("unknown-query-type") + } + + poller := &taskPoller{ + engine: s.engine, + domain: s.domainName, + taskList: taskList, + identity: identity, + decisionHandler: dtHandler, + activityHandler: atHandler, + queryHandler: queryHandler, + logger: s.logger, + suite: s, + sticktTaskList: stickyTaskList, + stickyScheduleToStartTimeoutSeconds: stickyScheduleToStartTimeoutSeconds, + } + + // Make first decision to schedule activity + _, err := poller.pollAndProcessDecisionTask(false, false) + s.logger.Infof("pollAndProcessDecisionTask: %v", err) + s.Nil(err) + + type QueryResult struct { + Resp *workflow.QueryWorkflowResponse + Err error + } + queryResultCh := make(chan QueryResult) + queryWorkflowFn := func(queryType string) { + queryResp, err := s.engine.QueryWorkflow(createContext(), &workflow.QueryWorkflowRequest{ + Domain: common.StringPtr(s.domainName), + Execution: &workflow.WorkflowExecution{ + WorkflowId: common.StringPtr(id), + RunId: common.StringPtr(*we.RunId), + }, + Query: &workflow.WorkflowQuery{ + QueryType: common.StringPtr(queryType), + }, + }) + queryResultCh <- QueryResult{Resp: queryResp, Err: err} + } + + // call QueryWorkflow in separate goroutinue (because it is blocking). That will generate a query task + go queryWorkflowFn(queryType) + // process that query task, which should respond via RespondQueryTaskCompleted + for { + // loop until process the query task + isQueryTask, errInner := poller.pollAndProcessDecisionTask(false, false) + s.logger.Infof("pollAndProcessDecisionTask: %v", err) + s.Nil(errInner) + if isQueryTask { + break + } + } // wait until query result is ready + queryResult := <-queryResultCh + s.NoError(queryResult.Err) + s.NotNil(queryResult.Resp) + s.NotNil(queryResult.Resp.QueryResult) + queryResultString := string(queryResult.Resp.QueryResult) + s.Equal("query-result", queryResultString) + + go queryWorkflowFn("invalid-query-type") + for { + // loop until process the query task + isQueryTask, errInner := poller.pollAndProcessDecisionTask(false, false) + s.logger.Infof("pollAndProcessDecisionTask: %v", err) + s.Nil(errInner) + if isQueryTask { + break + } + } + queryResult = <-queryResultCh + s.NotNil(queryResult.Err) + queryFailError, ok := queryResult.Err.(*workflow.QueryFailedError) + s.True(ok) + s.Equal("unknown-query-type", queryFailError.Message) +} + func (s *integrationSuite) TestQueryWorkflow_NonSticky() { id := "interation-query-workflow-test" wt := "interation-query-workflow-test-type" @@ -1889,11 +2046,124 @@ func (s *integrationSuite) TestQueryWorkflow_NonSticky() { queryFailError, ok := queryResult.Err.(*workflow.QueryFailedError) s.True(ok) s.Equal("unknown-query-type", queryFailError.Message) - fmt.Println("$$$$$$$$$$$$$$$$$$$$$$$$$$") } func (s *integrationSuite) TestDescribeWorkflowExecution_Sticky() { - // TODO + id := "interation-describe-wfe-test" + wt := "interation-describe-wfe-test-type" + tl := "interation-describe-wfe-test-tasklist" + stl := "interation-query-workflow-test-tasklist-sticky" + identity := "worker1" + + workflowType := &workflow.WorkflowType{} + workflowType.Name = common.StringPtr(wt) + + taskList := &workflow.TaskList{} + taskList.Name = common.StringPtr(tl) + + stickyTaskList := &workflow.TaskList{} + stickyTaskList.Name = common.StringPtr(stl) + stickyScheduleToStartTimeoutSeconds := common.Int32Ptr(10) + + execution := workflow.WorkflowExecution{ + WorkflowId: common.StringPtr(id), + } + + // Start workflow execution + request := &workflow.StartWorkflowExecutionRequest{ + RequestId: common.StringPtr(uuid.New()), + Domain: common.StringPtr(s.domainName), + WorkflowId: common.StringPtr(id), + WorkflowType: workflowType, + TaskList: taskList, + Input: nil, + ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(100), + TaskStartToCloseTimeoutSeconds: common.Int32Ptr(1), + Identity: common.StringPtr(identity), + } + + resp, err0 := s.engine.StartWorkflowExecution(createContext(), request) + execution.RunId = resp.RunId + s.Nil(err0) + + s.logger.Infof("StartWorkflowExecution: response: %v \n", *resp.RunId) + + describeWorkflowExecution := func() (*workflow.DescribeWorkflowExecutionResponse, error) { + return s.engine.DescribeWorkflowExecution(createContext(), &workflow.DescribeWorkflowExecutionRequest{ + Domain: common.StringPtr(s.domainName), + Execution: &execution, + }) + } + dweResponse, err := describeWorkflowExecution() + s.Nil(err) + s.True(nil == dweResponse.WorkflowExecutionInfo.CloseTime) + s.Equal(int64(2), *dweResponse.WorkflowExecutionInfo.HistoryLength) // WorkflowStarted, DecisionScheduled + + // decider logic + workflowComplete := false + signalSent := false + var signalEvent *workflow.HistoryEvent + dtHandler := func(execution *workflow.WorkflowExecution, wt *workflow.WorkflowType, + previousStartedEventID, startedEventID int64, history *workflow.History) ([]byte, []*workflow.Decision, error) { + if !signalSent { + signalSent = true + + s.NoError(err) + return nil, []*workflow.Decision{{ + DecisionType: common.DecisionTypePtr(workflow.DecisionTypeScheduleActivityTask), + ScheduleActivityTaskDecisionAttributes: &workflow.ScheduleActivityTaskDecisionAttributes{ + ActivityId: common.StringPtr("1"), + ActivityType: &workflow.ActivityType{Name: common.StringPtr("test-activity-type")}, + TaskList: &workflow.TaskList{Name: &tl}, + Input: []byte("test-input"), + ScheduleToCloseTimeoutSeconds: common.Int32Ptr(100), + ScheduleToStartTimeoutSeconds: common.Int32Ptr(2), + StartToCloseTimeoutSeconds: common.Int32Ptr(50), + HeartbeatTimeoutSeconds: common.Int32Ptr(5), + }, + }}, nil + } else if previousStartedEventID > 0 && signalEvent == nil { + for _, event := range history.Events[previousStartedEventID:] { + if *event.EventType == workflow.EventTypeWorkflowExecutionSignaled { + signalEvent = event + } + } + } + + workflowComplete = true + return nil, []*workflow.Decision{{ + DecisionType: common.DecisionTypePtr(workflow.DecisionTypeCompleteWorkflowExecution), + CompleteWorkflowExecutionDecisionAttributes: &workflow.CompleteWorkflowExecutionDecisionAttributes{ + Result: []byte("Done."), + }, + }}, nil + } + + poller := &taskPoller{ + engine: s.engine, + domain: s.domainName, + taskList: taskList, + identity: identity, + decisionHandler: dtHandler, + activityHandler: nil, + logger: s.logger, + suite: s, + sticktTaskList: stickyTaskList, + stickyScheduleToStartTimeoutSeconds: stickyScheduleToStartTimeoutSeconds, + } + + // first decision to schedule new activity, tell server can use sticky tasklist + _, err = poller.pollAndProcessDecisionTaskWithAttempt(false, false, false, true, int64(0)) + s.logger.Infof("pollAndProcessDecisionTask: %v", err) + s.Nil(err) + + dweResponse, err = describeWorkflowExecution() + s.Nil(err) + s.True(nil == dweResponse.WorkflowExecutionInfo.CloseStatus) + s.Equal(int64(5), *dweResponse.WorkflowExecutionInfo.HistoryLength) // DecisionStarted, DecisionCompleted, ActivityScheduled + s.Equal(tl, dweResponse.ExecutionConfiguration.TaskList.GetName()) + s.Equal(stl, dweResponse.ExecutionConfiguration.StickyTaskList.GetName()) + s.Equal(*stickyScheduleToStartTimeoutSeconds, *dweResponse.ExecutionConfiguration.StickyScheduleToStartTimeoutSeconds) } func (s *integrationSuite) TestDescribeWorkflowExecution_NonSticky() { diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index cf8e53ec96e..2b0114982f4 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -885,6 +885,7 @@ struct QueryWorkflowRequest { 10: optional string domain 20: optional WorkflowExecution execution 30: optional WorkflowQuery query + 40: optional bool isStickyQuery } struct QueryWorkflowResponse { diff --git a/service/frontend/handler.go b/service/frontend/handler.go index 79f0d185b55..8dd1e8e15b0 100644 --- a/service/frontend/handler.go +++ b/service/frontend/handler.go @@ -1339,6 +1339,11 @@ func (wh *WorkflowHandler) QueryWorkflow(ctx context.Context, return nil, wh.error(errQueryTypeNotSet, scope) } + isStickyQuery := false + if queryRequest.IsStickyQuery != nil { + isStickyQuery = queryRequest.GetIsStickyQuery() + } + domainInfo, _, err := wh.domainCache.GetDomain(queryRequest.GetDomain()) if err != nil { return nil, wh.error(err, scope) @@ -1366,6 +1371,9 @@ func (wh *WorkflowHandler) QueryWorkflow(ctx context.Context, queryRequest.Execution.RunId = response.WorkflowExecutionInfo.Execution.RunId if response.ExecutionConfiguration.StickyTaskList == nil || len(response.ExecutionConfiguration.StickyTaskList.GetName()) == 0 { matchingRequest.TaskList = response.ExecutionConfiguration.TaskList + } else if !isStickyQuery { + // sticky enabled on the client side, but client chose to use non sticky, which is also the default + matchingRequest.TaskList = response.ExecutionConfiguration.TaskList } else { matchingRequest.TaskList = response.ExecutionConfiguration.StickyTaskList } From b4a14e9b3f54fbab05b23918c9d38905a24b0e76 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Wed, 13 Dec 2017 22:53:23 -0800 Subject: [PATCH 3/5] use information from worker / client header to determine whether to use sticky query or not --- .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 158 +++++++++++----- client/history/client.go | 32 ++-- client/history/metricClient.go | 33 ++-- common/client/clientFeature.go | 63 +++++++ common/client/clientFeature_test.go | 57 ++++++ common/persistence/dataInterfaces.go | 3 + common/rpc.go | 17 ++ host/integration_test.go | 198 ++------------------- idl/github.com/uber/cadence/shared.thrift | 4 +- service/frontend/handler.go | 32 ++-- service/history/MockHistoryEngine.go | 4 +- service/history/handler.go | 2 +- service/history/historyEngine.go | 15 +- service/history/historyEngine2_test.go | 3 +- service/history/historyEngineInterfaces.go | 2 +- service/history/historyEngine_test.go | 90 +++++----- service/history/mutableStateBuilder.go | 14 +- 18 files changed, 406 insertions(+), 325 deletions(-) create mode 100644 common/client/clientFeature.go create mode 100644 common/client/clientFeature_test.go diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index 8b5acc38d9b..c2eb039c69a 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "876b2284c4024afe2e1246d330ed055cf1ec7c7b", + SHA1: "c8496bb37909935e3018e10fa9a14c7492bc8bcf", Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n 50: optional TaskList stickyTaskList\n 60: optional i32 stickyScheduleToStartTimeoutSeconds\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional string identity\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n 40: optional bool isStickyQuery\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n 50: optional TaskList stickyTaskList\n 60: optional i32 stickyScheduleToStartTimeoutSeconds\n 70: optional string clientLibraryVersion\n 80: optional string clientFeatureVersion\n 90: optional string clientLang\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional string identity\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index 9642db9c198..bc7948a41b3 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -13312,10 +13312,9 @@ func (v *QueryTaskCompletedType) UnmarshalJSON(text []byte) error { } type QueryWorkflowRequest struct { - Domain *string `json:"domain,omitempty"` - Execution *WorkflowExecution `json:"execution,omitempty"` - Query *WorkflowQuery `json:"query,omitempty"` - IsStickyQuery *bool `json:"isStickyQuery,omitempty"` + Domain *string `json:"domain,omitempty"` + Execution *WorkflowExecution `json:"execution,omitempty"` + Query *WorkflowQuery `json:"query,omitempty"` } // ToWire translates a QueryWorkflowRequest struct into a Thrift-level intermediate @@ -13335,7 +13334,7 @@ type QueryWorkflowRequest struct { // } func (v *QueryWorkflowRequest) ToWire() (wire.Value, error) { var ( - fields [4]wire.Field + fields [3]wire.Field i int = 0 w wire.Value err error @@ -13365,14 +13364,6 @@ func (v *QueryWorkflowRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 30, Value: w} i++ } - if v.IsStickyQuery != nil { - w, err = wire.NewValueBool(*(v.IsStickyQuery)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 40, Value: w} - i++ - } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -13424,16 +13415,6 @@ func (v *QueryWorkflowRequest) FromWire(w wire.Value) error { return err } - } - case 40: - if field.Value.Type() == wire.TBool { - var x bool - x, err = field.Value.GetBool(), error(nil) - v.IsStickyQuery = &x - if err != nil { - return err - } - } } } @@ -13448,7 +13429,7 @@ func (v *QueryWorkflowRequest) String() string { return "" } - var fields [4]string + var fields [3]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -13462,10 +13443,6 @@ func (v *QueryWorkflowRequest) String() string { fields[i] = fmt.Sprintf("Query: %v", v.Query) i++ } - if v.IsStickyQuery != nil { - fields[i] = fmt.Sprintf("IsStickyQuery: %v", *(v.IsStickyQuery)) - i++ - } return fmt.Sprintf("QueryWorkflowRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -13484,9 +13461,6 @@ func (v *QueryWorkflowRequest) Equals(rhs *QueryWorkflowRequest) bool { if !((v.Query == nil && rhs.Query == nil) || (v.Query != nil && rhs.Query != nil && v.Query.Equals(rhs.Query))) { return false } - if !_Bool_EqualsPtr(v.IsStickyQuery, rhs.IsStickyQuery) { - return false - } return true } @@ -13501,16 +13475,6 @@ func (v *QueryWorkflowRequest) GetDomain() (o string) { return } -// GetIsStickyQuery returns the value of IsStickyQuery if it is set or its -// zero value if it is unset. -func (v *QueryWorkflowRequest) GetIsStickyQuery() (o bool) { - if v.IsStickyQuery != nil { - return *v.IsStickyQuery - } - - return -} - type QueryWorkflowResponse struct { QueryResult []byte `json:"queryResult,omitempty"` } @@ -23136,6 +23100,9 @@ type WorkflowExecutionConfiguration struct { ChildPolicy *ChildPolicy `json:"childPolicy,omitempty"` StickyTaskList *TaskList `json:"stickyTaskList,omitempty"` StickyScheduleToStartTimeoutSeconds *int32 `json:"stickyScheduleToStartTimeoutSeconds,omitempty"` + ClientLibraryVersion *string `json:"clientLibraryVersion,omitempty"` + ClientFeatureVersion *string `json:"clientFeatureVersion,omitempty"` + ClientLang *string `json:"clientLang,omitempty"` } // ToWire translates a WorkflowExecutionConfiguration struct into a Thrift-level intermediate @@ -23155,7 +23122,7 @@ type WorkflowExecutionConfiguration struct { // } func (v *WorkflowExecutionConfiguration) ToWire() (wire.Value, error) { var ( - fields [6]wire.Field + fields [9]wire.Field i int = 0 w wire.Value err error @@ -23209,6 +23176,30 @@ func (v *WorkflowExecutionConfiguration) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 60, Value: w} i++ } + if v.ClientLibraryVersion != nil { + w, err = wire.NewValueString(*(v.ClientLibraryVersion)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 70, Value: w} + i++ + } + if v.ClientFeatureVersion != nil { + w, err = wire.NewValueString(*(v.ClientFeatureVersion)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 80, Value: w} + i++ + } + if v.ClientLang != nil { + w, err = wire.NewValueString(*(v.ClientLang)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 90, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -23290,6 +23281,36 @@ func (v *WorkflowExecutionConfiguration) FromWire(w wire.Value) error { return err } + } + case 70: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.ClientLibraryVersion = &x + if err != nil { + return err + } + + } + case 80: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.ClientFeatureVersion = &x + if err != nil { + return err + } + + } + case 90: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.ClientLang = &x + if err != nil { + return err + } + } } } @@ -23304,7 +23325,7 @@ func (v *WorkflowExecutionConfiguration) String() string { return "" } - var fields [6]string + var fields [9]string i := 0 if v.TaskList != nil { fields[i] = fmt.Sprintf("TaskList: %v", v.TaskList) @@ -23330,6 +23351,18 @@ func (v *WorkflowExecutionConfiguration) String() string { fields[i] = fmt.Sprintf("StickyScheduleToStartTimeoutSeconds: %v", *(v.StickyScheduleToStartTimeoutSeconds)) i++ } + if v.ClientLibraryVersion != nil { + fields[i] = fmt.Sprintf("ClientLibraryVersion: %v", *(v.ClientLibraryVersion)) + i++ + } + if v.ClientFeatureVersion != nil { + fields[i] = fmt.Sprintf("ClientFeatureVersion: %v", *(v.ClientFeatureVersion)) + i++ + } + if v.ClientLang != nil { + fields[i] = fmt.Sprintf("ClientLang: %v", *(v.ClientLang)) + i++ + } return fmt.Sprintf("WorkflowExecutionConfiguration{%v}", strings.Join(fields[:i], ", ")) } @@ -23357,6 +23390,15 @@ func (v *WorkflowExecutionConfiguration) Equals(rhs *WorkflowExecutionConfigurat if !_I32_EqualsPtr(v.StickyScheduleToStartTimeoutSeconds, rhs.StickyScheduleToStartTimeoutSeconds) { return false } + if !_String_EqualsPtr(v.ClientLibraryVersion, rhs.ClientLibraryVersion) { + return false + } + if !_String_EqualsPtr(v.ClientFeatureVersion, rhs.ClientFeatureVersion) { + return false + } + if !_String_EqualsPtr(v.ClientLang, rhs.ClientLang) { + return false + } return true } @@ -23401,6 +23443,36 @@ func (v *WorkflowExecutionConfiguration) GetStickyScheduleToStartTimeoutSeconds( return } +// GetClientLibraryVersion returns the value of ClientLibraryVersion if it is set or its +// zero value if it is unset. +func (v *WorkflowExecutionConfiguration) GetClientLibraryVersion() (o string) { + if v.ClientLibraryVersion != nil { + return *v.ClientLibraryVersion + } + + return +} + +// GetClientFeatureVersion returns the value of ClientFeatureVersion if it is set or its +// zero value if it is unset. +func (v *WorkflowExecutionConfiguration) GetClientFeatureVersion() (o string) { + if v.ClientFeatureVersion != nil { + return *v.ClientFeatureVersion + } + + return +} + +// GetClientLang returns the value of ClientLang if it is set or its +// zero value if it is unset. +func (v *WorkflowExecutionConfiguration) GetClientLang() (o string) { + if v.ClientLang != nil { + return *v.ClientLang + } + + return +} + type WorkflowExecutionContinuedAsNewEventAttributes struct { NewExecutionRunId *string `json:"newExecutionRunId,omitempty"` WorkflowType *WorkflowType `json:"workflowType,omitempty"` diff --git a/client/history/client.go b/client/history/client.go index e88d06195e7..acbe9267058 100644 --- a/client/history/client.go +++ b/client/history/client.go @@ -75,7 +75,7 @@ func (c *clientImpl) StartWorkflowExecution( var err error ctx, cancel := c.createContext(ctx) defer cancel() - response, err = client.StartWorkflowExecution(ctx, request) + response, err = client.StartWorkflowExecution(ctx, request, opts...) return err } err = c.executeWithRedirect(ctx, client, op) @@ -98,7 +98,7 @@ func (c *clientImpl) GetWorkflowExecutionNextEventID( var err error ctx, cancel := c.createContext(ctx) defer cancel() - response, err = client.GetWorkflowExecutionNextEventID(ctx, request) + response, err = client.GetWorkflowExecutionNextEventID(ctx, request, opts...) return err } err = c.executeWithRedirect(ctx, client, op) @@ -121,7 +121,7 @@ func (c *clientImpl) DescribeWorkflowExecution( var err error ctx, cancel := c.createContext(ctx) defer cancel() - response, err = client.DescribeWorkflowExecution(ctx, request) + response, err = client.DescribeWorkflowExecution(ctx, request, opts...) return err } err = c.executeWithRedirect(ctx, client, op) @@ -144,7 +144,7 @@ func (c *clientImpl) RecordDecisionTaskStarted( var err error ctx, cancel := c.createContext(ctx) defer cancel() - response, err = client.RecordDecisionTaskStarted(ctx, request) + response, err = client.RecordDecisionTaskStarted(ctx, request, opts...) return err } err = c.executeWithRedirect(ctx, client, op) @@ -167,7 +167,7 @@ func (c *clientImpl) RecordActivityTaskStarted( var err error ctx, cancel := c.createContext(ctx) defer cancel() - response, err = client.RecordActivityTaskStarted(ctx, request) + response, err = client.RecordActivityTaskStarted(ctx, request, opts...) return err } err = c.executeWithRedirect(ctx, client, op) @@ -192,7 +192,7 @@ func (c *clientImpl) RespondDecisionTaskCompleted( op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() - return client.RespondDecisionTaskCompleted(ctx, request) + return client.RespondDecisionTaskCompleted(ctx, request, opts...) } err = c.executeWithRedirect(ctx, client, op) return err @@ -213,7 +213,7 @@ func (c *clientImpl) RespondDecisionTaskFailed( op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() - return client.RespondDecisionTaskFailed(ctx, request) + return client.RespondDecisionTaskFailed(ctx, request, opts...) } err = c.executeWithRedirect(ctx, client, op) return err @@ -234,7 +234,7 @@ func (c *clientImpl) RespondActivityTaskCompleted( op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() - return client.RespondActivityTaskCompleted(ctx, request) + return client.RespondActivityTaskCompleted(ctx, request, opts...) } err = c.executeWithRedirect(ctx, client, op) return err @@ -255,7 +255,7 @@ func (c *clientImpl) RespondActivityTaskFailed( op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() - return client.RespondActivityTaskFailed(ctx, request) + return client.RespondActivityTaskFailed(ctx, request, opts...) } err = c.executeWithRedirect(ctx, client, op) return err @@ -276,7 +276,7 @@ func (c *clientImpl) RespondActivityTaskCanceled( op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() - return client.RespondActivityTaskCanceled(ctx, request) + return client.RespondActivityTaskCanceled(ctx, request, opts...) } err = c.executeWithRedirect(ctx, client, op) return err @@ -299,7 +299,7 @@ func (c *clientImpl) RecordActivityTaskHeartbeat( var err error ctx, cancel := c.createContext(ctx) defer cancel() - response, err = client.RecordActivityTaskHeartbeat(ctx, request) + response, err = client.RecordActivityTaskHeartbeat(ctx, request, opts...) return err } err = c.executeWithRedirect(ctx, client, op) @@ -320,7 +320,7 @@ func (c *clientImpl) RequestCancelWorkflowExecution( op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() - return client.RequestCancelWorkflowExecution(ctx, request) + return client.RequestCancelWorkflowExecution(ctx, request, opts...) } return c.executeWithRedirect(ctx, client, op) } @@ -336,7 +336,7 @@ func (c *clientImpl) SignalWorkflowExecution( op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() - return client.SignalWorkflowExecution(ctx, request) + return client.SignalWorkflowExecution(ctx, request, opts...) } err = c.executeWithRedirect(ctx, client, op) @@ -354,7 +354,7 @@ func (c *clientImpl) TerminateWorkflowExecution( op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() - return client.TerminateWorkflowExecution(ctx, request) + return client.TerminateWorkflowExecution(ctx, request, opts...) } err = c.executeWithRedirect(ctx, client, op) return err @@ -371,7 +371,7 @@ func (c *clientImpl) ScheduleDecisionTask( op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() - return client.ScheduleDecisionTask(ctx, request) + return client.ScheduleDecisionTask(ctx, request, opts...) } err = c.executeWithRedirect(ctx, client, op) return err @@ -388,7 +388,7 @@ func (c *clientImpl) RecordChildExecutionCompleted( op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() - return client.RecordChildExecutionCompleted(ctx, request) + return client.RecordChildExecutionCompleted(ctx, request, opts...) } err = c.executeWithRedirect(ctx, client, op) return err diff --git a/client/history/metricClient.go b/client/history/metricClient.go index 4d883a9aa59..7e7e3d50b32 100644 --- a/client/history/metricClient.go +++ b/client/history/metricClient.go @@ -22,6 +22,7 @@ package history import ( "context" + h "github.com/uber/cadence/.gen/go/history" "github.com/uber/cadence/.gen/go/shared" "github.com/uber/cadence/common/metrics" @@ -50,7 +51,7 @@ func (c *metricClient) StartWorkflowExecution( c.metricsClient.IncCounter(metrics.HistoryClientStartWorkflowExecutionScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientStartWorkflowExecutionScope, metrics.CadenceLatency) - resp, err := c.client.StartWorkflowExecution(context, request) + resp, err := c.client.StartWorkflowExecution(context, request, opts...) sw.Stop() if err != nil { @@ -67,7 +68,7 @@ func (c *metricClient) GetWorkflowExecutionNextEventID( c.metricsClient.IncCounter(metrics.HistoryClientGetWorkflowExecutionNextEventIDScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientGetWorkflowExecutionNextEventIDScope, metrics.CadenceLatency) - resp, err := c.client.GetWorkflowExecutionNextEventID(context, request) + resp, err := c.client.GetWorkflowExecutionNextEventID(context, request, opts...) sw.Stop() if err != nil { @@ -84,7 +85,7 @@ func (c *metricClient) DescribeWorkflowExecution( c.metricsClient.IncCounter(metrics.HistoryClientDescribeWorkflowExecutionScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientDescribeWorkflowExecutionScope, metrics.CadenceLatency) - resp, err := c.client.DescribeWorkflowExecution(context, request) + resp, err := c.client.DescribeWorkflowExecution(context, request, opts...) sw.Stop() if err != nil { @@ -101,7 +102,7 @@ func (c *metricClient) RecordDecisionTaskStarted( c.metricsClient.IncCounter(metrics.HistoryClientRecordDecisionTaskStartedScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientRecordDecisionTaskStartedScope, metrics.CadenceLatency) - resp, err := c.client.RecordDecisionTaskStarted(context, request) + resp, err := c.client.RecordDecisionTaskStarted(context, request, opts...) sw.Stop() if err != nil { @@ -118,7 +119,7 @@ func (c *metricClient) RecordActivityTaskStarted( c.metricsClient.IncCounter(metrics.HistoryClientRecordActivityTaskStartedScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientRecordActivityTaskStartedScope, metrics.CadenceLatency) - resp, err := c.client.RecordActivityTaskStarted(context, request) + resp, err := c.client.RecordActivityTaskStarted(context, request, opts...) sw.Stop() if err != nil { @@ -135,7 +136,7 @@ func (c *metricClient) RespondDecisionTaskCompleted( c.metricsClient.IncCounter(metrics.HistoryClientRespondDecisionTaskCompletedScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientRespondDecisionTaskCompletedScope, metrics.CadenceLatency) - err := c.client.RespondDecisionTaskCompleted(context, request) + err := c.client.RespondDecisionTaskCompleted(context, request, opts...) sw.Stop() if err != nil { @@ -152,7 +153,7 @@ func (c *metricClient) RespondDecisionTaskFailed( c.metricsClient.IncCounter(metrics.HistoryClientRespondDecisionTaskFailedScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientRespondDecisionTaskFailedScope, metrics.CadenceLatency) - err := c.client.RespondDecisionTaskFailed(context, request) + err := c.client.RespondDecisionTaskFailed(context, request, opts...) sw.Stop() if err != nil { @@ -169,7 +170,7 @@ func (c *metricClient) RespondActivityTaskCompleted( c.metricsClient.IncCounter(metrics.HistoryClientRespondActivityTaskCompletedScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientRespondActivityTaskCompletedScope, metrics.CadenceLatency) - err := c.client.RespondActivityTaskCompleted(context, request) + err := c.client.RespondActivityTaskCompleted(context, request, opts...) sw.Stop() if err != nil { @@ -186,7 +187,7 @@ func (c *metricClient) RespondActivityTaskFailed( c.metricsClient.IncCounter(metrics.HistoryClientRespondActivityTaskFailedScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientRespondActivityTaskFailedScope, metrics.CadenceLatency) - err := c.client.RespondActivityTaskFailed(context, request) + err := c.client.RespondActivityTaskFailed(context, request, opts...) sw.Stop() if err != nil { @@ -203,7 +204,7 @@ func (c *metricClient) RespondActivityTaskCanceled( c.metricsClient.IncCounter(metrics.HistoryClientRespondActivityTaskCanceledScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientRespondActivityTaskCanceledScope, metrics.CadenceLatency) - err := c.client.RespondActivityTaskCanceled(context, request) + err := c.client.RespondActivityTaskCanceled(context, request, opts...) sw.Stop() if err != nil { @@ -220,7 +221,7 @@ func (c *metricClient) RecordActivityTaskHeartbeat( c.metricsClient.IncCounter(metrics.HistoryClientRecordActivityTaskHeartbeatScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientRecordActivityTaskHeartbeatScope, metrics.CadenceLatency) - resp, err := c.client.RecordActivityTaskHeartbeat(context, request) + resp, err := c.client.RecordActivityTaskHeartbeat(context, request, opts...) sw.Stop() if err != nil { @@ -237,7 +238,7 @@ func (c *metricClient) RequestCancelWorkflowExecution( c.metricsClient.IncCounter(metrics.HistoryClientRequestCancelWorkflowExecutionScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientRequestCancelWorkflowExecutionScope, metrics.CadenceLatency) - err := c.client.RequestCancelWorkflowExecution(context, request) + err := c.client.RequestCancelWorkflowExecution(context, request, opts...) sw.Stop() if err != nil { @@ -254,7 +255,7 @@ func (c *metricClient) SignalWorkflowExecution( c.metricsClient.IncCounter(metrics.HistoryClientSignalWorkflowExecutionScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientSignalWorkflowExecutionScope, metrics.CadenceLatency) - err := c.client.SignalWorkflowExecution(context, request) + err := c.client.SignalWorkflowExecution(context, request, opts...) sw.Stop() if err != nil { @@ -271,7 +272,7 @@ func (c *metricClient) TerminateWorkflowExecution( c.metricsClient.IncCounter(metrics.HistoryClientTerminateWorkflowExecutionScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientTerminateWorkflowExecutionScope, metrics.CadenceLatency) - err := c.client.TerminateWorkflowExecution(context, request) + err := c.client.TerminateWorkflowExecution(context, request, opts...) sw.Stop() if err != nil { @@ -288,7 +289,7 @@ func (c *metricClient) ScheduleDecisionTask( c.metricsClient.IncCounter(metrics.HistoryClientScheduleDecisionTaskScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientScheduleDecisionTaskScope, metrics.CadenceLatency) - err := c.client.ScheduleDecisionTask(context, request) + err := c.client.ScheduleDecisionTask(context, request, opts...) sw.Stop() if err != nil { @@ -305,7 +306,7 @@ func (c *metricClient) RecordChildExecutionCompleted( c.metricsClient.IncCounter(metrics.HistoryClientRecordChildExecutionCompletedScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.HistoryClientRecordChildExecutionCompletedScope, metrics.CadenceLatency) - err := c.client.RecordChildExecutionCompleted(context, request) + err := c.client.RecordChildExecutionCompleted(context, request, opts...) sw.Stop() if err != nil { diff --git a/common/client/clientFeature.go b/common/client/clientFeature.go new file mode 100644 index 00000000000..af9f26bd2d6 --- /dev/null +++ b/common/client/clientFeature.go @@ -0,0 +1,63 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package client + +import ( + "strconv" +) + +const ( + intBase = 10 + intBitSize = 32 +) + +type ( + // Feature provides information about client's capibility + Feature interface { + SupportStickyQuery() bool + } + + // FeatureImpl is used for determining the client's capibility. + // This can be useful when service support a feature, while + // client does not, so we can use be backward comparible + FeatureImpl struct { + libVersion string + featureVersion int + lang string + } +) + +// NewFeatureImpl make a new NewFeatureImpl +func NewFeatureImpl(libVersion string, featureVersion string, lang string) *FeatureImpl { + impl := &FeatureImpl{ + libVersion: libVersion, + lang: lang, + } + if feature, err := strconv.ParseInt(featureVersion, intBase, intBitSize); err == nil { + impl.featureVersion = int(feature) + } + return impl +} + +// SupportStickyQuery whether a client support sticky query +func (feature *FeatureImpl) SupportStickyQuery() bool { + return feature.featureVersion > 0 +} diff --git a/common/client/clientFeature_test.go b/common/client/clientFeature_test.go new file mode 100644 index 00000000000..eb2c2a06edd --- /dev/null +++ b/common/client/clientFeature_test.go @@ -0,0 +1,57 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package client + +import ( + "testing" + + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" +) + +type ( + FeatureSuite struct { + *require.Assertions // override suite.Suite.Assertions with require.Assertions; this means that s.NotNil(nil) will stop the test, not merely log an error + suite.Suite + } +) + +func TestFeatureSuiteSuite(t *testing.T) { + suite.Run(t, new(FeatureSuite)) +} + +func (s *FeatureSuite) SetupTest() { + s.Assertions = require.New(s.T()) // Have to define our overridden assertions in the test setup. If we did it earlier, s.T() will return nil +} + +func (s *FeatureSuite) TestSupportStickyQuery() { + libVersion := "lib ver" + featureVersion := "1" + lang := "go" + feature := NewFeatureImpl(libVersion, featureVersion, lang) + s.True(feature.SupportStickyQuery(), "Should support sticky query") + + libVersion = "" + featureVersion = "" + lang = "" + feature = NewFeatureImpl(libVersion, featureVersion, lang) + s.False(feature.SupportStickyQuery(), "Should support sticky query") +} diff --git a/common/persistence/dataInterfaces.go b/common/persistence/dataInterfaces.go index d79454f6b49..794a370c0be 100644 --- a/common/persistence/dataInterfaces.go +++ b/common/persistence/dataInterfaces.go @@ -142,6 +142,9 @@ type ( CancelRequestID string StickyTaskList string StickyScheduleToStartTimeout int32 + ClientLibraryVersion string + ClientFeatureVersion string + ClientLang string } // TransferTaskInfo describes a transfer task diff --git a/common/rpc.go b/common/rpc.go index 951f724cd10..0f4d9ffb035 100644 --- a/common/rpc.go +++ b/common/rpc.go @@ -24,6 +24,23 @@ import ( "go.uber.org/yarpc" ) +const ( + // LibraryVersionHeaderName refers to the name of the + // tchannel / http header that contains the client + // library version + LibraryVersionHeaderName = "cadence-client-library-version" + + // FeatureVersionHeaderName refers to the name of the + // tchannel / http header that contains the client + // feature version + FeatureVersionHeaderName = "cadence-client-feature-version" + + // LanguageHeaderName refers to the name of the + // tchannel / http header that contains the client + // language + LanguageHeaderName = "cadence-client-language" +) + type ( // RPCFactory Creates a dispatcher that knows how to transport requests. RPCFactory interface { diff --git a/host/integration_test.go b/host/integration_test.go index c2733c3c5f0..42570f600f6 100644 --- a/host/integration_test.go +++ b/host/integration_test.go @@ -37,6 +37,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "github.com/uber-common/bark" + "go.uber.org/yarpc" wsc "github.com/uber/cadence/.gen/go/cadence/workflowserviceclient" workflow "github.com/uber/cadence/.gen/go/shared" @@ -613,16 +614,22 @@ Loop: }) } // sticky tasklist - return false, p.engine.RespondDecisionTaskCompleted(createContext(), &workflow.RespondDecisionTaskCompletedRequest{ - TaskToken: response.TaskToken, - Identity: common.StringPtr(p.identity), - ExecutionContext: executionCtx, - Decisions: decisions, - StickyAttributes: &workflow.StickyExecutionAttributes{ - WorkerTaskList: p.sticktTaskList, - ScheduleToStartTimeoutSeconds: p.stickyScheduleToStartTimeoutSeconds, + return false, p.engine.RespondDecisionTaskCompleted( + createContext(), + &workflow.RespondDecisionTaskCompletedRequest{ + TaskToken: response.TaskToken, + Identity: common.StringPtr(p.identity), + ExecutionContext: executionCtx, + Decisions: decisions, + StickyAttributes: &workflow.StickyExecutionAttributes{ + WorkerTaskList: p.sticktTaskList, + ScheduleToStartTimeoutSeconds: p.stickyScheduleToStartTimeoutSeconds, + }, }, - }) + yarpc.WithHeader(common.LibraryVersionHeaderName, "0.0.1"), + yarpc.WithHeader(common.FeatureVersionHeaderName, "1"), + yarpc.WithHeader(common.LanguageHeaderName, "go"), + ) } return false, matching.ErrNoTasks @@ -1669,7 +1676,6 @@ func (s *integrationSuite) TestQueryWorkflow_Sticky() { Query: &workflow.WorkflowQuery{ QueryType: common.StringPtr(queryType), }, - IsStickyQuery: common.BoolPtr(true), }) queryResultCh <- QueryResult{Resp: queryResp, Err: err} } @@ -1711,178 +1717,6 @@ func (s *integrationSuite) TestQueryWorkflow_Sticky() { s.Equal("unknown-query-type", queryFailError.Message) } -func (s *integrationSuite) TestQueryWorkflow_Sticky_UseNonSticky() { - id := "interation-query-workflow-test" - wt := "interation-query-workflow-test-type" - tl := "interation-query-workflow-test-tasklist" - stl := "interation-query-workflow-test-tasklist-sticky" - identity := "worker1" - activityName := "activity_type1" - queryType := "test-query" - - workflowType := &workflow.WorkflowType{} - workflowType.Name = common.StringPtr(wt) - - taskList := &workflow.TaskList{} - taskList.Name = common.StringPtr(tl) - - stickyTaskList := &workflow.TaskList{} - stickyTaskList.Name = common.StringPtr(stl) - stickyScheduleToStartTimeoutSeconds := common.Int32Ptr(10) - - // Start workflow execution - request := &workflow.StartWorkflowExecutionRequest{ - RequestId: common.StringPtr(uuid.New()), - Domain: common.StringPtr(s.domainName), - WorkflowId: common.StringPtr(id), - WorkflowType: workflowType, - TaskList: taskList, - Input: nil, - ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(100), - TaskStartToCloseTimeoutSeconds: common.Int32Ptr(1), - Identity: common.StringPtr(identity), - } - - we, err0 := s.engine.StartWorkflowExecution(createContext(), request) - s.Nil(err0) - - s.logger.Infof("StartWorkflowExecution: response: %v \n", *we.RunId) - - // decider logic - workflowComplete := false - activityScheduled := false - activityData := int32(1) - var signalEvent *workflow.HistoryEvent - dtHandler := func(execution *workflow.WorkflowExecution, wt *workflow.WorkflowType, - previousStartedEventID, startedEventID int64, history *workflow.History) ([]byte, []*workflow.Decision, error) { - - if !activityScheduled { - activityScheduled = true - buf := new(bytes.Buffer) - s.Nil(binary.Write(buf, binary.LittleEndian, activityData)) - - return nil, []*workflow.Decision{{ - DecisionType: common.DecisionTypePtr(workflow.DecisionTypeScheduleActivityTask), - ScheduleActivityTaskDecisionAttributes: &workflow.ScheduleActivityTaskDecisionAttributes{ - ActivityId: common.StringPtr(strconv.Itoa(int(1))), - ActivityType: &workflow.ActivityType{Name: common.StringPtr(activityName)}, - TaskList: &workflow.TaskList{Name: &tl}, - Input: buf.Bytes(), - ScheduleToCloseTimeoutSeconds: common.Int32Ptr(100), - ScheduleToStartTimeoutSeconds: common.Int32Ptr(2), - StartToCloseTimeoutSeconds: common.Int32Ptr(50), - HeartbeatTimeoutSeconds: common.Int32Ptr(5), - }, - }}, nil - } else if previousStartedEventID > 0 { - for _, event := range history.Events[previousStartedEventID:] { - if *event.EventType == workflow.EventTypeWorkflowExecutionSignaled { - signalEvent = event - return nil, []*workflow.Decision{}, nil - } - } - } - - workflowComplete = true - return nil, []*workflow.Decision{{ - DecisionType: common.DecisionTypePtr(workflow.DecisionTypeCompleteWorkflowExecution), - CompleteWorkflowExecutionDecisionAttributes: &workflow.CompleteWorkflowExecutionDecisionAttributes{ - Result: []byte("Done."), - }, - }}, nil - } - - // activity handler - atHandler := func(execution *workflow.WorkflowExecution, activityType *workflow.ActivityType, - activityID string, input []byte, taskToken []byte) ([]byte, bool, error) { - - return []byte("Activity Result."), false, nil - } - - queryHandler := func(task *workflow.PollForDecisionTaskResponse) ([]byte, error) { - s.NotNil(task.Query) - s.NotNil(task.Query.QueryType) - if *task.Query.QueryType == queryType { - return []byte("query-result"), nil - } - - return nil, errors.New("unknown-query-type") - } - - poller := &taskPoller{ - engine: s.engine, - domain: s.domainName, - taskList: taskList, - identity: identity, - decisionHandler: dtHandler, - activityHandler: atHandler, - queryHandler: queryHandler, - logger: s.logger, - suite: s, - sticktTaskList: stickyTaskList, - stickyScheduleToStartTimeoutSeconds: stickyScheduleToStartTimeoutSeconds, - } - - // Make first decision to schedule activity - _, err := poller.pollAndProcessDecisionTask(false, false) - s.logger.Infof("pollAndProcessDecisionTask: %v", err) - s.Nil(err) - - type QueryResult struct { - Resp *workflow.QueryWorkflowResponse - Err error - } - queryResultCh := make(chan QueryResult) - queryWorkflowFn := func(queryType string) { - queryResp, err := s.engine.QueryWorkflow(createContext(), &workflow.QueryWorkflowRequest{ - Domain: common.StringPtr(s.domainName), - Execution: &workflow.WorkflowExecution{ - WorkflowId: common.StringPtr(id), - RunId: common.StringPtr(*we.RunId), - }, - Query: &workflow.WorkflowQuery{ - QueryType: common.StringPtr(queryType), - }, - }) - queryResultCh <- QueryResult{Resp: queryResp, Err: err} - } - - // call QueryWorkflow in separate goroutinue (because it is blocking). That will generate a query task - go queryWorkflowFn(queryType) - // process that query task, which should respond via RespondQueryTaskCompleted - for { - // loop until process the query task - isQueryTask, errInner := poller.pollAndProcessDecisionTask(false, false) - s.logger.Infof("pollAndProcessDecisionTask: %v", err) - s.Nil(errInner) - if isQueryTask { - break - } - } // wait until query result is ready - queryResult := <-queryResultCh - s.NoError(queryResult.Err) - s.NotNil(queryResult.Resp) - s.NotNil(queryResult.Resp.QueryResult) - queryResultString := string(queryResult.Resp.QueryResult) - s.Equal("query-result", queryResultString) - - go queryWorkflowFn("invalid-query-type") - for { - // loop until process the query task - isQueryTask, errInner := poller.pollAndProcessDecisionTask(false, false) - s.logger.Infof("pollAndProcessDecisionTask: %v", err) - s.Nil(errInner) - if isQueryTask { - break - } - } - queryResult = <-queryResultCh - s.NotNil(queryResult.Err) - queryFailError, ok := queryResult.Err.(*workflow.QueryFailedError) - s.True(ok) - s.Equal("unknown-query-type", queryFailError.Message) -} - func (s *integrationSuite) TestQueryWorkflow_NonSticky() { id := "interation-query-workflow-test" wt := "interation-query-workflow-test-type" diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index 2b0114982f4..cef958cc234 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -204,6 +204,9 @@ struct WorkflowExecutionConfiguration { 40: optional ChildPolicy childPolicy 50: optional TaskList stickyTaskList 60: optional i32 stickyScheduleToStartTimeoutSeconds + 70: optional string clientLibraryVersion + 80: optional string clientFeatureVersion + 90: optional string clientLang } struct TransientDecisionInfo { @@ -885,7 +888,6 @@ struct QueryWorkflowRequest { 10: optional string domain 20: optional WorkflowExecution execution 30: optional WorkflowQuery query - 40: optional bool isStickyQuery } struct QueryWorkflowResponse { diff --git a/service/frontend/handler.go b/service/frontend/handler.go index 8dd1e8e15b0..8564bdb51e4 100644 --- a/service/frontend/handler.go +++ b/service/frontend/handler.go @@ -38,10 +38,12 @@ import ( "github.com/uber/cadence/client/matching" "github.com/uber/cadence/common" "github.com/uber/cadence/common/cache" + "github.com/uber/cadence/common/client" "github.com/uber/cadence/common/logging" "github.com/uber/cadence/common/metrics" "github.com/uber/cadence/common/persistence" "github.com/uber/cadence/common/service" + "go.uber.org/yarpc" ) var _ workflowserviceserver.Interface = (*WorkflowHandler)(nil) @@ -743,10 +745,20 @@ func (wh *WorkflowHandler) RespondDecisionTaskCompleted( return wh.error(errDomainNotSet, scope) } - err = wh.history.RespondDecisionTaskCompleted(ctx, &h.RespondDecisionTaskCompletedRequest{ - DomainUUID: common.StringPtr(taskToken.DomainID), - CompleteRequest: completeRequest, - }) + var headers []yarpc.CallOption + call := yarpc.CallFromContext(ctx) + for _, key := range call.HeaderNames() { + value := call.Header(key) + headers = append(headers, yarpc.WithHeader(key, value)) + } + err = wh.history.RespondDecisionTaskCompleted( + ctx, + &h.RespondDecisionTaskCompletedRequest{ + DomainUUID: common.StringPtr(taskToken.DomainID), + CompleteRequest: completeRequest, + }, + headers..., + ) if err != nil { return wh.error(err, scope) } @@ -1339,11 +1351,6 @@ func (wh *WorkflowHandler) QueryWorkflow(ctx context.Context, return nil, wh.error(errQueryTypeNotSet, scope) } - isStickyQuery := false - if queryRequest.IsStickyQuery != nil { - isStickyQuery = queryRequest.GetIsStickyQuery() - } - domainInfo, _, err := wh.domainCache.GetDomain(queryRequest.GetDomain()) if err != nil { return nil, wh.error(err, scope) @@ -1367,11 +1374,16 @@ func (wh *WorkflowHandler) QueryWorkflow(ctx context.Context, if err != nil { return nil, wh.error(err, scope) } + clientFeature := client.NewFeatureImpl( + *response.ExecutionConfiguration.ClientLibraryVersion, + *response.ExecutionConfiguration.ClientFeatureVersion, + *response.ExecutionConfiguration.ClientLang, + ) queryRequest.Execution.RunId = response.WorkflowExecutionInfo.Execution.RunId if response.ExecutionConfiguration.StickyTaskList == nil || len(response.ExecutionConfiguration.StickyTaskList.GetName()) == 0 { matchingRequest.TaskList = response.ExecutionConfiguration.TaskList - } else if !isStickyQuery { + } else if !clientFeature.SupportStickyQuery() { // sticky enabled on the client side, but client chose to use non sticky, which is also the default matchingRequest.TaskList = response.ExecutionConfiguration.TaskList } else { diff --git a/service/history/MockHistoryEngine.go b/service/history/MockHistoryEngine.go index 481636d93b6..bb49c3094fa 100644 --- a/service/history/MockHistoryEngine.go +++ b/service/history/MockHistoryEngine.go @@ -159,8 +159,8 @@ func (_m *MockHistoryEngine) RecordActivityTaskStarted(request *gohistory.Record } // RespondDecisionTaskCompleted is mock implementation for RespondDecisionTaskCompleted of HistoryEngine -func (_m *MockHistoryEngine) RespondDecisionTaskCompleted(request *gohistory.RespondDecisionTaskCompletedRequest) error { - ret := _m.Called(request) +func (_m *MockHistoryEngine) RespondDecisionTaskCompleted(ctx context.Context, request *gohistory.RespondDecisionTaskCompletedRequest) error { + ret := _m.Called(ctx, request) var r0 error if rf, ok := ret.Get(0).(func(*gohistory.RespondDecisionTaskCompletedRequest) error); ok { diff --git a/service/history/handler.go b/service/history/handler.go index ee08952c794..ed07082e4ee 100644 --- a/service/history/handler.go +++ b/service/history/handler.go @@ -397,7 +397,7 @@ func (h *Handler) RespondDecisionTaskCompleted(ctx context.Context, return err1 } - err2 := engine.RespondDecisionTaskCompleted(wrappedRequest) + err2 := engine.RespondDecisionTaskCompleted(ctx, wrappedRequest) if err2 != nil { h.updateErrorMetric(metrics.HistoryRespondDecisionTaskCompletedScope, h.convertError(err2)) return h.convertError(err2) diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index 2cf9e612b24..a5cb1877b4d 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -26,6 +26,8 @@ import ( "fmt" "time" + "go.uber.org/yarpc" + "github.com/pborman/uuid" "github.com/uber-common/bark" h "github.com/uber/cadence/.gen/go/history" @@ -404,6 +406,9 @@ func (e *historyEngineImpl) DescribeWorkflowExecution( ChildPolicy: common.ChildPolicyPtr(workflow.ChildPolicyTerminate), StickyTaskList: &workflow.TaskList{Name: common.StringPtr(msBuilder.executionInfo.StickyTaskList)}, StickyScheduleToStartTimeoutSeconds: common.Int32Ptr(msBuilder.executionInfo.StickyScheduleToStartTimeout), + ClientLibraryVersion: common.StringPtr(msBuilder.executionInfo.ClientLibraryVersion), + ClientFeatureVersion: common.StringPtr(msBuilder.executionInfo.ClientFeatureVersion), + ClientLang: common.StringPtr(msBuilder.executionInfo.ClientLang), }, WorkflowExecutionInfo: &workflow.WorkflowExecutionInfo{ Execution: request.Request.Execution, @@ -627,7 +632,7 @@ Update_History_Loop: } // RespondDecisionTaskCompleted completes a decision task -func (e *historyEngineImpl) RespondDecisionTaskCompleted(req *h.RespondDecisionTaskCompletedRequest) error { +func (e *historyEngineImpl) RespondDecisionTaskCompleted(ctx context.Context, req *h.RespondDecisionTaskCompletedRequest) error { domainID, err := getDomainUUID(req.DomainUUID) if err != nil { return err @@ -643,6 +648,11 @@ func (e *historyEngineImpl) RespondDecisionTaskCompleted(req *h.RespondDecisionT RunId: common.StringPtr(token.RunID), } + call := yarpc.CallFromContext(ctx) + clientLibVersion := call.Header(common.LibraryVersionHeaderName) + clientFeatureVersion := call.Header(common.FeatureVersionHeaderName) + clientLang := call.Header(common.LanguageHeaderName) + context, release, err0 := e.historyCache.getOrCreateWorkflowExecution(domainID, workflowExecution) if err0 != nil { return err0 @@ -700,6 +710,9 @@ Update_History_Loop: msBuilder.executionInfo.StickyTaskList = request.StickyAttributes.WorkerTaskList.GetName() msBuilder.executionInfo.StickyScheduleToStartTimeout = request.StickyAttributes.GetScheduleToStartTimeoutSeconds() } + msBuilder.executionInfo.ClientLibraryVersion = clientLibVersion + msBuilder.executionInfo.ClientFeatureVersion = clientFeatureVersion + msBuilder.executionInfo.ClientLang = clientLang Process_Decision_Loop: for _, d := range request.Decisions { diff --git a/service/history/historyEngine2_test.go b/service/history/historyEngine2_test.go index 4b389aef8d2..ca5f6ee951f 100644 --- a/service/history/historyEngine2_test.go +++ b/service/history/historyEngine2_test.go @@ -21,6 +21,7 @@ package history import ( + "context" "encoding/json" "errors" "os" @@ -673,7 +674,7 @@ func (s *engine2Suite) TestRespondDecisionTaskCompletedRecordMarkerDecision() { s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.historyEngine.RespondDecisionTaskCompleted(&h.RespondDecisionTaskCompletedRequest{ + err := s.historyEngine.RespondDecisionTaskCompleted(context.Background(), &h.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, diff --git a/service/history/historyEngineInterfaces.go b/service/history/historyEngineInterfaces.go index a505a8eccc6..b7a85e6bb34 100644 --- a/service/history/historyEngineInterfaces.go +++ b/service/history/historyEngineInterfaces.go @@ -54,7 +54,7 @@ type ( request *h.DescribeWorkflowExecutionRequest) (*workflow.DescribeWorkflowExecutionResponse, error) RecordDecisionTaskStarted(request *h.RecordDecisionTaskStartedRequest) (*h.RecordDecisionTaskStartedResponse, error) RecordActivityTaskStarted(request *h.RecordActivityTaskStartedRequest) (*h.RecordActivityTaskStartedResponse, error) - RespondDecisionTaskCompleted(request *h.RespondDecisionTaskCompletedRequest) error + RespondDecisionTaskCompleted(ctx context.Context, request *h.RespondDecisionTaskCompletedRequest) error RespondDecisionTaskFailed(request *h.RespondDecisionTaskFailedRequest) error RespondActivityTaskCompleted(request *h.RespondActivityTaskCompletedRequest) error RespondActivityTaskFailed(request *h.RespondActivityTaskFailedRequest) error diff --git a/service/history/historyEngine_test.go b/service/history/historyEngine_test.go index 3a4fda8046d..102a96da5f8 100644 --- a/service/history/historyEngine_test.go +++ b/service/history/historyEngine_test.go @@ -213,7 +213,7 @@ func (s *engineSuite) TestGetWorkflowExecutionNextEventIDLongPoll() { timer := time.NewTimer(delay) <-timer.C - s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -279,7 +279,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedInvalidToken() { invalidToken, _ := json.Marshal("bad token") identity := "testIdentity" - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: invalidToken, @@ -304,7 +304,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedIfNoExecution() { s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(nil, &workflow.EntityNotExistsError{}).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -326,7 +326,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedIfGetExecutionFailed() { s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(nil, errors.New("FAILED")).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -364,7 +364,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedUpdateExecutionFailed() { s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(errors.New("FAILED")).Once() s.mockShardManager.On("UpdateShard", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -400,7 +400,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedIfTaskCompleted() { s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse, nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -434,7 +434,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedIfTaskNotStarted() { s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse, nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -452,7 +452,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedConflictOnUpdate() { } tl := "testTaskList" identity := "testIdentity" - context := []byte("context") + executionContext := []byte("context") activity1ID := "activity1" activity1Type := "activity_type1" activity1Input := []byte("input1") @@ -520,19 +520,19 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedConflictOnUpdate() { s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, Decisions: decisions, - ExecutionContext: context, + ExecutionContext: executionContext, Identity: &identity, }, }) s.Nil(err, s.printHistory(msBuilder)) s.Equal(int64(16), ms2.ExecutionInfo.NextEventID) s.Equal(*decisionStartedEvent2.EventId, ms2.ExecutionInfo.LastProcessedEvent) - s.Equal(context, ms2.ExecutionInfo.ExecutionContext) + s.Equal(executionContext, ms2.ExecutionInfo.ExecutionContext) executionBuilder := s.getBuilder(domainID, we) activity3Attributes := s.getActivityScheduledEvent(executionBuilder, 13).ActivityTaskScheduledEventAttributes @@ -564,7 +564,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedMaxAttemptsExceeded() { ScheduleID: 2, }) identity := "testIdentity" - context := []byte("context") + executionContext := []byte("context") input := []byte("input") msBuilder := newMutableStateBuilder(s.config, bark.NewLoggerFromLogrus(log.New())) @@ -596,12 +596,12 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedMaxAttemptsExceeded() { &persistence.ConditionFailedError{}).Once() } - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, Decisions: decisions, - ExecutionContext: context, + ExecutionContext: executionContext, Identity: &identity, }, }) @@ -617,7 +617,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedCompleteWorkflowFailed() { } tl := "testTaskList" identity := "testIdentity" - context := []byte("context") + executionContext := []byte("context") activity1ID := "activity1" activity1Type := "activity_type1" activity1Input := []byte("input1") @@ -669,12 +669,12 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedCompleteWorkflowFailed() { s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, Decisions: decisions, - ExecutionContext: context, + ExecutionContext: executionContext, Identity: &identity, }, }) @@ -682,7 +682,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedCompleteWorkflowFailed() { executionBuilder := s.getBuilder(domainID, we) s.Equal(int64(14), executionBuilder.executionInfo.NextEventID) s.Equal(*decisionStartedEvent1.EventId, executionBuilder.executionInfo.LastProcessedEvent) - s.Equal(context, executionBuilder.executionInfo.ExecutionContext) + s.Equal(executionContext, executionBuilder.executionInfo.ExecutionContext) s.Equal(persistence.WorkflowStateRunning, executionBuilder.executionInfo.State) s.True(executionBuilder.HasPendingDecisionTask()) di3, ok := executionBuilder.GetPendingDecision(executionBuilder.executionInfo.NextEventID) @@ -699,7 +699,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedFailWorkflowFailed() { } tl := "testTaskList" identity := "testIdentity" - context := []byte("context") + executionContext := []byte("context") activity1ID := "activity1" activity1Type := "activity_type1" activity1Input := []byte("input1") @@ -753,12 +753,12 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedFailWorkflowFailed() { s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, Decisions: decisions, - ExecutionContext: context, + ExecutionContext: executionContext, Identity: &identity, }, }) @@ -766,7 +766,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedFailWorkflowFailed() { executionBuilder := s.getBuilder(domainID, we) s.Equal(int64(14), executionBuilder.executionInfo.NextEventID) s.Equal(*decisionStartedEvent1.EventId, executionBuilder.executionInfo.LastProcessedEvent) - s.Equal(context, executionBuilder.executionInfo.ExecutionContext) + s.Equal(executionContext, executionBuilder.executionInfo.ExecutionContext) s.Equal(persistence.WorkflowStateRunning, executionBuilder.executionInfo.State) s.True(executionBuilder.HasPendingDecisionTask()) di3, ok := executionBuilder.GetPendingDecision(executionBuilder.executionInfo.NextEventID) @@ -783,7 +783,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedBadDecisionAttributes() { } tl := "testTaskList" identity := "testIdentity" - context := []byte("context") + executionContext := []byte("context") activity1ID := "activity1" activity1Type := "activity_type1" activity1Input := []byte("input1") @@ -823,12 +823,12 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedBadDecisionAttributes() { s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, Decisions: decisions, - ExecutionContext: context, + ExecutionContext: executionContext, Identity: &identity, }, }) @@ -849,7 +849,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedSingleActivityScheduledDec ScheduleID: 2, }) identity := "testIdentity" - context := []byte("context") + executionContext := []byte("context") input := []byte("input") msBuilder := newMutableStateBuilder(s.config, bark.NewLoggerFromLogrus(log.New())) @@ -878,12 +878,12 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedSingleActivityScheduledDec s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, Decisions: decisions, - ExecutionContext: context, + ExecutionContext: executionContext, Identity: &identity, }, }) @@ -891,7 +891,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedSingleActivityScheduledDec executionBuilder := s.getBuilder(domainID, we) s.Equal(int64(6), executionBuilder.executionInfo.NextEventID) s.Equal(int64(3), executionBuilder.executionInfo.LastProcessedEvent) - s.Equal(context, executionBuilder.executionInfo.ExecutionContext) + s.Equal(executionContext, executionBuilder.executionInfo.ExecutionContext) s.Equal(persistence.WorkflowStateRunning, executionBuilder.executionInfo.State) s.False(executionBuilder.HasPendingDecisionTask()) @@ -920,7 +920,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedCompleteWorkflowSuccess() ScheduleID: 2, }) identity := "testIdentity" - context := []byte("context") + executionContext := []byte("context") workflowResult := []byte("success") msBuilder := newMutableStateBuilder(s.config, bark.NewLoggerFromLogrus(log.New())) @@ -944,12 +944,12 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedCompleteWorkflowSuccess() s.mockMetadataMgr.On("GetDomain", mock.Anything).Return( &persistence.GetDomainResponse{Config: &persistence.DomainConfig{Retention: 1}}, nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, Decisions: decisions, - ExecutionContext: context, + ExecutionContext: executionContext, Identity: &identity, }, }) @@ -957,7 +957,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedCompleteWorkflowSuccess() executionBuilder := s.getBuilder(domainID, we) s.Equal(int64(6), executionBuilder.executionInfo.NextEventID) s.Equal(int64(3), executionBuilder.executionInfo.LastProcessedEvent) - s.Equal(context, executionBuilder.executionInfo.ExecutionContext) + s.Equal(executionContext, executionBuilder.executionInfo.ExecutionContext) s.Equal(persistence.WorkflowStateCompleted, executionBuilder.executionInfo.State) s.False(executionBuilder.HasPendingDecisionTask()) } @@ -975,7 +975,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedFailWorkflowSuccess() { ScheduleID: 2, }) identity := "testIdentity" - context := []byte("context") + executionContext := []byte("context") details := []byte("fail workflow details") reason := "fail workflow reason" @@ -1001,12 +1001,12 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedFailWorkflowSuccess() { s.mockMetadataMgr.On("GetDomain", mock.Anything).Return( &persistence.GetDomainResponse{Config: &persistence.DomainConfig{Retention: 1}}, nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, Decisions: decisions, - ExecutionContext: context, + ExecutionContext: executionContext, Identity: &identity, }, }) @@ -1014,7 +1014,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedFailWorkflowSuccess() { executionBuilder := s.getBuilder(domainID, we) s.Equal(int64(6), executionBuilder.executionInfo.NextEventID) s.Equal(int64(3), executionBuilder.executionInfo.LastProcessedEvent) - s.Equal(context, executionBuilder.executionInfo.ExecutionContext) + s.Equal(executionContext, executionBuilder.executionInfo.ExecutionContext) s.Equal(persistence.WorkflowStateCompleted, executionBuilder.executionInfo.State) s.False(executionBuilder.HasPendingDecisionTask()) } @@ -2411,7 +2411,7 @@ func (s *engineSuite) TestRequestCancel_RespondDecisionTaskCompleted_NotSchedule s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -2470,7 +2470,7 @@ func (s *engineSuite) TestRequestCancel_RespondDecisionTaskCompleted_Scheduled() s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -2531,7 +2531,7 @@ func (s *engineSuite) TestRequestCancel_RespondDecisionTaskCompleted_NoHeartBeat s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -2633,7 +2633,7 @@ func (s *engineSuite) TestRequestCancel_RespondDecisionTaskCompleted_Success() { s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -2728,7 +2728,7 @@ func (s *engineSuite) TestStarTimer_DuplicateTimerID() { s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -2770,7 +2770,7 @@ func (s *engineSuite) TestStarTimer_DuplicateTimerID() { }).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err = s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err = s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken2, @@ -2832,7 +2832,7 @@ func (s *engineSuite) TestUserTimer_RespondDecisionTaskCompleted() { s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, @@ -2885,7 +2885,7 @@ func (s *engineSuite) TestCancelTimer_RespondDecisionTaskCompleted_NoStartTimer( s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once() s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once() - err := s.mockHistoryEngine.RespondDecisionTaskCompleted(&history.RespondDecisionTaskCompletedRequest{ + err := s.mockHistoryEngine.RespondDecisionTaskCompleted(context.Background(), &history.RespondDecisionTaskCompletedRequest{ DomainUUID: common.StringPtr(domainID), CompleteRequest: &workflow.RespondDecisionTaskCompletedRequest{ TaskToken: taskToken, diff --git a/service/history/mutableStateBuilder.go b/service/history/mutableStateBuilder.go index 79ad6751c30..e3c848d851f 100644 --- a/service/history/mutableStateBuilder.go +++ b/service/history/mutableStateBuilder.go @@ -665,8 +665,7 @@ func (e *mutableStateBuilder) DeleteDecision() { func (e *mutableStateBuilder) FailDecision() { // Clear stickiness whenever decision fails - e.executionInfo.StickyTaskList = "" - e.executionInfo.StickyScheduleToStartTimeout = 0 + e.clearStickyness() failDecisionInfo := &decisionInfo{ ScheduleID: emptyEventID, @@ -678,6 +677,14 @@ func (e *mutableStateBuilder) FailDecision() { e.UpdateDecision(failDecisionInfo) } +func (e *mutableStateBuilder) clearStickyness() { + e.executionInfo.StickyTaskList = "" + e.executionInfo.StickyScheduleToStartTimeout = 0 + e.executionInfo.ClientLibraryVersion = "" + e.executionInfo.ClientFeatureVersion = "" + e.executionInfo.ClientLang = "" +} + // GetNextEventID returns next event ID func (e *mutableStateBuilder) GetNextEventID() int64 { return e.executionInfo.NextEventID @@ -925,8 +932,7 @@ func (e *mutableStateBuilder) AddDecisionTaskScheduleToStartTimeoutEvent(schedul } // Clear stickiness whenever decision fails - e.executionInfo.StickyTaskList = "" - e.executionInfo.StickyScheduleToStartTimeout = 0 + e.clearStickyness() event := e.hBuilder.AddDecisionTaskTimedOutEvent(scheduleEventID, 0, workflow.TimeoutTypeScheduleToStart) From c43a59de8bfe7f989d6a0042013eb14969c6db4e Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Fri, 15 Dec 2017 13:32:24 -0800 Subject: [PATCH 4/5] rename GetWorkflowNextEventID to GetMutableState, add missing persistence of client version --- ...d.go => historyservice_getmutablestate.go} | 176 +++++----- .../go/history/historyserviceclient/client.go | 18 +- .../go/history/historyserviceserver/server.go | 20 +- .gen/go/history/historyservicetest/client.go | 20 +- .gen/go/history/idl.go | 4 +- .gen/go/history/types.go | 324 ++++++++++++++---- .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 172 +--------- client/history/client.go | 39 ++- client/history/metricClient.go | 14 +- client/matching/client.go | 50 ++- client/matching/metricClient.go | 22 +- common/client/clientFeature.go | 56 ++- common/client/clientFeature_test.go | 6 +- common/metrics/defs.go | 114 +++--- common/mocks/HistoryClient.go | 12 +- common/persistence/cassandraPersistence.go | 17 +- .../persistence/cassandraPersistence_test.go | 15 + common/persistence/dataInterfaces.go | 2 +- common/rpc.go | 7 +- host/integration_test.go | 124 +------ idl/github.com/uber/cadence/history.thrift | 23 +- idl/github.com/uber/cadence/shared.thrift | 5 - schema/cadence/schema.cql | 3 + .../versioned/v0.3/add_client_version.cql | 3 + schema/cadence/versioned/v0.3/manifest.json | 8 + service/frontend/handler.go | 52 +-- service/history/MockHistoryEngine.go | 12 +- service/history/handler.go | 16 +- service/history/historyEngine.go | 49 +-- service/history/historyEngineInterfaces.go | 2 +- service/history/historyEngine_test.go | 22 +- service/history/mutableStateBuilder.go | 2 +- service/history/service.go | 2 +- service/matching/matchingEngine.go | 15 +- tools/cassandra/updateTask_test.go | 2 +- 36 files changed, 721 insertions(+), 711 deletions(-) rename .gen/go/history/{historyservice_getworkflowexecutionnexteventid.go => historyservice_getmutablestate.go} (57%) create mode 100644 schema/cadence/versioned/v0.3/add_client_version.cql create mode 100644 schema/cadence/versioned/v0.3/manifest.json diff --git a/.gen/go/history/historyservice_getworkflowexecutionnexteventid.go b/.gen/go/history/historyservice_getmutablestate.go similarity index 57% rename from .gen/go/history/historyservice_getworkflowexecutionnexteventid.go rename to .gen/go/history/historyservice_getmutablestate.go index 815c48121f4..e7a421ff0f5 100644 --- a/.gen/go/history/historyservice_getworkflowexecutionnexteventid.go +++ b/.gen/go/history/historyservice_getmutablestate.go @@ -31,14 +31,14 @@ import ( "strings" ) -// HistoryService_GetWorkflowExecutionNextEventID_Args represents the arguments for the HistoryService.GetWorkflowExecutionNextEventID function. +// HistoryService_GetMutableState_Args represents the arguments for the HistoryService.GetMutableState function. // -// The arguments for GetWorkflowExecutionNextEventID are sent and received over the wire as this struct. -type HistoryService_GetWorkflowExecutionNextEventID_Args struct { - GetRequest *GetWorkflowExecutionNextEventIDRequest `json:"getRequest,omitempty"` +// The arguments for GetMutableState are sent and received over the wire as this struct. +type HistoryService_GetMutableState_Args struct { + GetRequest *GetMutableStateRequest `json:"getRequest,omitempty"` } -// ToWire translates a HistoryService_GetWorkflowExecutionNextEventID_Args struct into a Thrift-level intermediate +// ToWire translates a HistoryService_GetMutableState_Args struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -53,7 +53,7 @@ type HistoryService_GetWorkflowExecutionNextEventID_Args struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *HistoryService_GetWorkflowExecutionNextEventID_Args) ToWire() (wire.Value, error) { +func (v *HistoryService_GetMutableState_Args) ToWire() (wire.Value, error) { var ( fields [1]wire.Field i int = 0 @@ -73,17 +73,17 @@ func (v *HistoryService_GetWorkflowExecutionNextEventID_Args) ToWire() (wire.Val return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _GetWorkflowExecutionNextEventIDRequest_Read(w wire.Value) (*GetWorkflowExecutionNextEventIDRequest, error) { - var v GetWorkflowExecutionNextEventIDRequest +func _GetMutableStateRequest_Read(w wire.Value) (*GetMutableStateRequest, error) { + var v GetMutableStateRequest err := v.FromWire(w) return &v, err } -// FromWire deserializes a HistoryService_GetWorkflowExecutionNextEventID_Args struct from its Thrift-level +// FromWire deserializes a HistoryService_GetMutableState_Args struct from its Thrift-level // representation. The Thrift-level representation may be obtained // from a ThriftRW protocol implementation. // -// An error is returned if we were unable to build a HistoryService_GetWorkflowExecutionNextEventID_Args struct +// An error is returned if we were unable to build a HistoryService_GetMutableState_Args struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -91,19 +91,19 @@ func _GetWorkflowExecutionNextEventIDRequest_Read(w wire.Value) (*GetWorkflowExe // return nil, err // } // -// var v HistoryService_GetWorkflowExecutionNextEventID_Args +// var v HistoryService_GetMutableState_Args // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *HistoryService_GetWorkflowExecutionNextEventID_Args) FromWire(w wire.Value) error { +func (v *HistoryService_GetMutableState_Args) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { switch field.ID { case 1: if field.Value.Type() == wire.TStruct { - v.GetRequest, err = _GetWorkflowExecutionNextEventIDRequest_Read(field.Value) + v.GetRequest, err = _GetMutableStateRequest_Read(field.Value) if err != nil { return err } @@ -115,9 +115,9 @@ func (v *HistoryService_GetWorkflowExecutionNextEventID_Args) FromWire(w wire.Va return nil } -// String returns a readable string representation of a HistoryService_GetWorkflowExecutionNextEventID_Args +// String returns a readable string representation of a HistoryService_GetMutableState_Args // struct. -func (v *HistoryService_GetWorkflowExecutionNextEventID_Args) String() string { +func (v *HistoryService_GetMutableState_Args) String() string { if v == nil { return "" } @@ -129,14 +129,14 @@ func (v *HistoryService_GetWorkflowExecutionNextEventID_Args) String() string { i++ } - return fmt.Sprintf("HistoryService_GetWorkflowExecutionNextEventID_Args{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("HistoryService_GetMutableState_Args{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this HistoryService_GetWorkflowExecutionNextEventID_Args match the -// provided HistoryService_GetWorkflowExecutionNextEventID_Args. +// Equals returns true if all the fields of this HistoryService_GetMutableState_Args match the +// provided HistoryService_GetMutableState_Args. // // This function performs a deep comparison. -func (v *HistoryService_GetWorkflowExecutionNextEventID_Args) Equals(rhs *HistoryService_GetWorkflowExecutionNextEventID_Args) bool { +func (v *HistoryService_GetMutableState_Args) Equals(rhs *HistoryService_GetMutableState_Args) bool { if !((v.GetRequest == nil && rhs.GetRequest == nil) || (v.GetRequest != nil && rhs.GetRequest != nil && v.GetRequest.Equals(rhs.GetRequest))) { return false } @@ -147,73 +147,73 @@ func (v *HistoryService_GetWorkflowExecutionNextEventID_Args) Equals(rhs *Histor // MethodName returns the name of the Thrift function as specified in // the IDL, for which this struct represent the arguments. // -// This will always be "GetWorkflowExecutionNextEventID" for this struct. -func (v *HistoryService_GetWorkflowExecutionNextEventID_Args) MethodName() string { - return "GetWorkflowExecutionNextEventID" +// This will always be "GetMutableState" for this struct. +func (v *HistoryService_GetMutableState_Args) MethodName() string { + return "GetMutableState" } // EnvelopeType returns the kind of value inside this struct. // // This will always be Call for this struct. -func (v *HistoryService_GetWorkflowExecutionNextEventID_Args) EnvelopeType() wire.EnvelopeType { +func (v *HistoryService_GetMutableState_Args) EnvelopeType() wire.EnvelopeType { return wire.Call } -// HistoryService_GetWorkflowExecutionNextEventID_Helper provides functions that aid in handling the -// parameters and return values of the HistoryService.GetWorkflowExecutionNextEventID +// HistoryService_GetMutableState_Helper provides functions that aid in handling the +// parameters and return values of the HistoryService.GetMutableState // function. -var HistoryService_GetWorkflowExecutionNextEventID_Helper = struct { - // Args accepts the parameters of GetWorkflowExecutionNextEventID in-order and returns +var HistoryService_GetMutableState_Helper = struct { + // Args accepts the parameters of GetMutableState in-order and returns // the arguments struct for the function. Args func( - getRequest *GetWorkflowExecutionNextEventIDRequest, - ) *HistoryService_GetWorkflowExecutionNextEventID_Args + getRequest *GetMutableStateRequest, + ) *HistoryService_GetMutableState_Args // IsException returns true if the given error can be thrown - // by GetWorkflowExecutionNextEventID. + // by GetMutableState. // - // An error can be thrown by GetWorkflowExecutionNextEventID only if the + // An error can be thrown by GetMutableState only if the // corresponding exception type was mentioned in the 'throws' // section for it in the Thrift file. IsException func(error) bool - // WrapResponse returns the result struct for GetWorkflowExecutionNextEventID + // WrapResponse returns the result struct for GetMutableState // given its return value and error. // // This allows mapping values and errors returned by - // GetWorkflowExecutionNextEventID into a serializable result struct. + // GetMutableState into a serializable result struct. // WrapResponse returns a non-nil error if the provided - // error cannot be thrown by GetWorkflowExecutionNextEventID + // error cannot be thrown by GetMutableState // - // value, err := GetWorkflowExecutionNextEventID(args) - // result, err := HistoryService_GetWorkflowExecutionNextEventID_Helper.WrapResponse(value, err) + // value, err := GetMutableState(args) + // result, err := HistoryService_GetMutableState_Helper.WrapResponse(value, err) // if err != nil { - // return fmt.Errorf("unexpected error from GetWorkflowExecutionNextEventID: %v", err) + // return fmt.Errorf("unexpected error from GetMutableState: %v", err) // } // serialize(result) - WrapResponse func(*GetWorkflowExecutionNextEventIDResponse, error) (*HistoryService_GetWorkflowExecutionNextEventID_Result, error) + WrapResponse func(*GetMutableStateResponse, error) (*HistoryService_GetMutableState_Result, error) - // UnwrapResponse takes the result struct for GetWorkflowExecutionNextEventID + // UnwrapResponse takes the result struct for GetMutableState // and returns the value or error returned by it. // - // The error is non-nil only if GetWorkflowExecutionNextEventID threw an + // The error is non-nil only if GetMutableState threw an // exception. // // result := deserialize(bytes) - // value, err := HistoryService_GetWorkflowExecutionNextEventID_Helper.UnwrapResponse(result) - UnwrapResponse func(*HistoryService_GetWorkflowExecutionNextEventID_Result) (*GetWorkflowExecutionNextEventIDResponse, error) + // value, err := HistoryService_GetMutableState_Helper.UnwrapResponse(result) + UnwrapResponse func(*HistoryService_GetMutableState_Result) (*GetMutableStateResponse, error) }{} func init() { - HistoryService_GetWorkflowExecutionNextEventID_Helper.Args = func( - getRequest *GetWorkflowExecutionNextEventIDRequest, - ) *HistoryService_GetWorkflowExecutionNextEventID_Args { - return &HistoryService_GetWorkflowExecutionNextEventID_Args{ + HistoryService_GetMutableState_Helper.Args = func( + getRequest *GetMutableStateRequest, + ) *HistoryService_GetMutableState_Args { + return &HistoryService_GetMutableState_Args{ GetRequest: getRequest, } } - HistoryService_GetWorkflowExecutionNextEventID_Helper.IsException = func(err error) bool { + HistoryService_GetMutableState_Helper.IsException = func(err error) bool { switch err.(type) { case *shared.BadRequestError: return true @@ -228,37 +228,37 @@ func init() { } } - HistoryService_GetWorkflowExecutionNextEventID_Helper.WrapResponse = func(success *GetWorkflowExecutionNextEventIDResponse, err error) (*HistoryService_GetWorkflowExecutionNextEventID_Result, error) { + HistoryService_GetMutableState_Helper.WrapResponse = func(success *GetMutableStateResponse, err error) (*HistoryService_GetMutableState_Result, error) { if err == nil { - return &HistoryService_GetWorkflowExecutionNextEventID_Result{Success: success}, nil + return &HistoryService_GetMutableState_Result{Success: success}, nil } switch e := err.(type) { case *shared.BadRequestError: if e == nil { - return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetWorkflowExecutionNextEventID_Result.BadRequestError") + return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.BadRequestError") } - return &HistoryService_GetWorkflowExecutionNextEventID_Result{BadRequestError: e}, nil + return &HistoryService_GetMutableState_Result{BadRequestError: e}, nil case *shared.InternalServiceError: if e == nil { - return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetWorkflowExecutionNextEventID_Result.InternalServiceError") + return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.InternalServiceError") } - return &HistoryService_GetWorkflowExecutionNextEventID_Result{InternalServiceError: e}, nil + return &HistoryService_GetMutableState_Result{InternalServiceError: e}, nil case *shared.EntityNotExistsError: if e == nil { - return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetWorkflowExecutionNextEventID_Result.EntityNotExistError") + return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.EntityNotExistError") } - return &HistoryService_GetWorkflowExecutionNextEventID_Result{EntityNotExistError: e}, nil + return &HistoryService_GetMutableState_Result{EntityNotExistError: e}, nil case *ShardOwnershipLostError: if e == nil { - return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetWorkflowExecutionNextEventID_Result.ShardOwnershipLostError") + return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.ShardOwnershipLostError") } - return &HistoryService_GetWorkflowExecutionNextEventID_Result{ShardOwnershipLostError: e}, nil + return &HistoryService_GetMutableState_Result{ShardOwnershipLostError: e}, nil } return nil, err } - HistoryService_GetWorkflowExecutionNextEventID_Helper.UnwrapResponse = func(result *HistoryService_GetWorkflowExecutionNextEventID_Result) (success *GetWorkflowExecutionNextEventIDResponse, err error) { + HistoryService_GetMutableState_Helper.UnwrapResponse = func(result *HistoryService_GetMutableState_Result) (success *GetMutableStateResponse, err error) { if result.BadRequestError != nil { err = result.BadRequestError return @@ -287,21 +287,21 @@ func init() { } -// HistoryService_GetWorkflowExecutionNextEventID_Result represents the result of a HistoryService.GetWorkflowExecutionNextEventID function call. +// HistoryService_GetMutableState_Result represents the result of a HistoryService.GetMutableState function call. // -// The result of a GetWorkflowExecutionNextEventID execution is sent and received over the wire as this struct. +// The result of a GetMutableState execution is sent and received over the wire as this struct. // // Success is set only if the function did not throw an exception. -type HistoryService_GetWorkflowExecutionNextEventID_Result struct { - // Value returned by GetWorkflowExecutionNextEventID after a successful execution. - Success *GetWorkflowExecutionNextEventIDResponse `json:"success,omitempty"` - BadRequestError *shared.BadRequestError `json:"badRequestError,omitempty"` - InternalServiceError *shared.InternalServiceError `json:"internalServiceError,omitempty"` - EntityNotExistError *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"` - ShardOwnershipLostError *ShardOwnershipLostError `json:"shardOwnershipLostError,omitempty"` +type HistoryService_GetMutableState_Result struct { + // Value returned by GetMutableState after a successful execution. + Success *GetMutableStateResponse `json:"success,omitempty"` + BadRequestError *shared.BadRequestError `json:"badRequestError,omitempty"` + InternalServiceError *shared.InternalServiceError `json:"internalServiceError,omitempty"` + EntityNotExistError *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"` + ShardOwnershipLostError *ShardOwnershipLostError `json:"shardOwnershipLostError,omitempty"` } -// ToWire translates a HistoryService_GetWorkflowExecutionNextEventID_Result struct into a Thrift-level intermediate +// ToWire translates a HistoryService_GetMutableState_Result struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -316,7 +316,7 @@ type HistoryService_GetWorkflowExecutionNextEventID_Result struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *HistoryService_GetWorkflowExecutionNextEventID_Result) ToWire() (wire.Value, error) { +func (v *HistoryService_GetMutableState_Result) ToWire() (wire.Value, error) { var ( fields [5]wire.Field i int = 0 @@ -366,23 +366,23 @@ func (v *HistoryService_GetWorkflowExecutionNextEventID_Result) ToWire() (wire.V } if i != 1 { - return wire.Value{}, fmt.Errorf("HistoryService_GetWorkflowExecutionNextEventID_Result should have exactly one field: got %v fields", i) + return wire.Value{}, fmt.Errorf("HistoryService_GetMutableState_Result should have exactly one field: got %v fields", i) } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _GetWorkflowExecutionNextEventIDResponse_Read(w wire.Value) (*GetWorkflowExecutionNextEventIDResponse, error) { - var v GetWorkflowExecutionNextEventIDResponse +func _GetMutableStateResponse_Read(w wire.Value) (*GetMutableStateResponse, error) { + var v GetMutableStateResponse err := v.FromWire(w) return &v, err } -// FromWire deserializes a HistoryService_GetWorkflowExecutionNextEventID_Result struct from its Thrift-level +// FromWire deserializes a HistoryService_GetMutableState_Result struct from its Thrift-level // representation. The Thrift-level representation may be obtained // from a ThriftRW protocol implementation. // -// An error is returned if we were unable to build a HistoryService_GetWorkflowExecutionNextEventID_Result struct +// An error is returned if we were unable to build a HistoryService_GetMutableState_Result struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -390,19 +390,19 @@ func _GetWorkflowExecutionNextEventIDResponse_Read(w wire.Value) (*GetWorkflowEx // return nil, err // } // -// var v HistoryService_GetWorkflowExecutionNextEventID_Result +// var v HistoryService_GetMutableState_Result // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *HistoryService_GetWorkflowExecutionNextEventID_Result) FromWire(w wire.Value) error { +func (v *HistoryService_GetMutableState_Result) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { switch field.ID { case 0: if field.Value.Type() == wire.TStruct { - v.Success, err = _GetWorkflowExecutionNextEventIDResponse_Read(field.Value) + v.Success, err = _GetMutableStateResponse_Read(field.Value) if err != nil { return err } @@ -460,15 +460,15 @@ func (v *HistoryService_GetWorkflowExecutionNextEventID_Result) FromWire(w wire. count++ } if count != 1 { - return fmt.Errorf("HistoryService_GetWorkflowExecutionNextEventID_Result should have exactly one field: got %v fields", count) + return fmt.Errorf("HistoryService_GetMutableState_Result should have exactly one field: got %v fields", count) } return nil } -// String returns a readable string representation of a HistoryService_GetWorkflowExecutionNextEventID_Result +// String returns a readable string representation of a HistoryService_GetMutableState_Result // struct. -func (v *HistoryService_GetWorkflowExecutionNextEventID_Result) String() string { +func (v *HistoryService_GetMutableState_Result) String() string { if v == nil { return "" } @@ -496,14 +496,14 @@ func (v *HistoryService_GetWorkflowExecutionNextEventID_Result) String() string i++ } - return fmt.Sprintf("HistoryService_GetWorkflowExecutionNextEventID_Result{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("HistoryService_GetMutableState_Result{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this HistoryService_GetWorkflowExecutionNextEventID_Result match the -// provided HistoryService_GetWorkflowExecutionNextEventID_Result. +// Equals returns true if all the fields of this HistoryService_GetMutableState_Result match the +// provided HistoryService_GetMutableState_Result. // // This function performs a deep comparison. -func (v *HistoryService_GetWorkflowExecutionNextEventID_Result) Equals(rhs *HistoryService_GetWorkflowExecutionNextEventID_Result) bool { +func (v *HistoryService_GetMutableState_Result) Equals(rhs *HistoryService_GetMutableState_Result) bool { if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) { return false } @@ -526,14 +526,14 @@ func (v *HistoryService_GetWorkflowExecutionNextEventID_Result) Equals(rhs *Hist // MethodName returns the name of the Thrift function as specified in // the IDL, for which this struct represent the result. // -// This will always be "GetWorkflowExecutionNextEventID" for this struct. -func (v *HistoryService_GetWorkflowExecutionNextEventID_Result) MethodName() string { - return "GetWorkflowExecutionNextEventID" +// This will always be "GetMutableState" for this struct. +func (v *HistoryService_GetMutableState_Result) MethodName() string { + return "GetMutableState" } // EnvelopeType returns the kind of value inside this struct. // // This will always be Reply for this struct. -func (v *HistoryService_GetWorkflowExecutionNextEventID_Result) EnvelopeType() wire.EnvelopeType { +func (v *HistoryService_GetMutableState_Result) EnvelopeType() wire.EnvelopeType { return wire.Reply } diff --git a/.gen/go/history/historyserviceclient/client.go b/.gen/go/history/historyserviceclient/client.go index 0ccff7c91fc..15f39d070a4 100644 --- a/.gen/go/history/historyserviceclient/client.go +++ b/.gen/go/history/historyserviceclient/client.go @@ -42,11 +42,11 @@ type Interface interface { opts ...yarpc.CallOption, ) (*shared.DescribeWorkflowExecutionResponse, error) - GetWorkflowExecutionNextEventID( + GetMutableState( ctx context.Context, - GetRequest *history.GetWorkflowExecutionNextEventIDRequest, + GetRequest *history.GetMutableStateRequest, opts ...yarpc.CallOption, - ) (*history.GetWorkflowExecutionNextEventIDResponse, error) + ) (*history.GetMutableStateResponse, error) RecordActivityTaskHeartbeat( ctx context.Context, @@ -180,13 +180,13 @@ func (c client) DescribeWorkflowExecution( return } -func (c client) GetWorkflowExecutionNextEventID( +func (c client) GetMutableState( ctx context.Context, - _GetRequest *history.GetWorkflowExecutionNextEventIDRequest, + _GetRequest *history.GetMutableStateRequest, opts ...yarpc.CallOption, -) (success *history.GetWorkflowExecutionNextEventIDResponse, err error) { +) (success *history.GetMutableStateResponse, err error) { - args := history.HistoryService_GetWorkflowExecutionNextEventID_Helper.Args(_GetRequest) + args := history.HistoryService_GetMutableState_Helper.Args(_GetRequest) var body wire.Value body, err = c.c.Call(ctx, args, opts...) @@ -194,12 +194,12 @@ func (c client) GetWorkflowExecutionNextEventID( return } - var result history.HistoryService_GetWorkflowExecutionNextEventID_Result + var result history.HistoryService_GetMutableState_Result if err = result.FromWire(body); err != nil { return } - success, err = history.HistoryService_GetWorkflowExecutionNextEventID_Helper.UnwrapResponse(&result) + success, err = history.HistoryService_GetMutableState_Helper.UnwrapResponse(&result) return } diff --git a/.gen/go/history/historyserviceserver/server.go b/.gen/go/history/historyserviceserver/server.go index bb8c9495af0..f87757f41fc 100644 --- a/.gen/go/history/historyserviceserver/server.go +++ b/.gen/go/history/historyserviceserver/server.go @@ -39,10 +39,10 @@ type Interface interface { DescribeRequest *history.DescribeWorkflowExecutionRequest, ) (*shared.DescribeWorkflowExecutionResponse, error) - GetWorkflowExecutionNextEventID( + GetMutableState( ctx context.Context, - GetRequest *history.GetWorkflowExecutionNextEventIDRequest, - ) (*history.GetWorkflowExecutionNextEventIDResponse, error) + GetRequest *history.GetMutableStateRequest, + ) (*history.GetMutableStateResponse, error) RecordActivityTaskHeartbeat( ctx context.Context, @@ -138,13 +138,13 @@ func New(impl Interface, opts ...thrift.RegisterOption) []transport.Procedure { }, thrift.Method{ - Name: "GetWorkflowExecutionNextEventID", + Name: "GetMutableState", HandlerSpec: thrift.HandlerSpec{ Type: transport.Unary, - Unary: thrift.UnaryHandler(h.GetWorkflowExecutionNextEventID), + Unary: thrift.UnaryHandler(h.GetMutableState), }, - Signature: "GetWorkflowExecutionNextEventID(GetRequest *history.GetWorkflowExecutionNextEventIDRequest) (*history.GetWorkflowExecutionNextEventIDResponse)", + Signature: "GetMutableState(GetRequest *history.GetMutableStateRequest) (*history.GetMutableStateResponse)", ThriftModule: history.ThriftModule, }, @@ -330,16 +330,16 @@ func (h handler) DescribeWorkflowExecution(ctx context.Context, body wire.Value) return response, err } -func (h handler) GetWorkflowExecutionNextEventID(ctx context.Context, body wire.Value) (thrift.Response, error) { - var args history.HistoryService_GetWorkflowExecutionNextEventID_Args +func (h handler) GetMutableState(ctx context.Context, body wire.Value) (thrift.Response, error) { + var args history.HistoryService_GetMutableState_Args if err := args.FromWire(body); err != nil { return thrift.Response{}, err } - success, err := h.impl.GetWorkflowExecutionNextEventID(ctx, args.GetRequest) + success, err := h.impl.GetMutableState(ctx, args.GetRequest) hadError := err != nil - result, err := history.HistoryService_GetWorkflowExecutionNextEventID_Helper.WrapResponse(success, err) + result, err := history.HistoryService_GetMutableState_Helper.WrapResponse(success, err) var response thrift.Response if err == nil { diff --git a/.gen/go/history/historyservicetest/client.go b/.gen/go/history/historyservicetest/client.go index 5e0d097f235..eadcf33dcd0 100644 --- a/.gen/go/history/historyservicetest/client.go +++ b/.gen/go/history/historyservicetest/client.go @@ -96,37 +96,37 @@ func (mr *_MockClientRecorder) DescribeWorkflowExecution( return mr.mock.ctrl.RecordCall(mr.mock, "DescribeWorkflowExecution", args...) } -// GetWorkflowExecutionNextEventID responds to a GetWorkflowExecutionNextEventID call based on the mock expectations. This +// GetMutableState responds to a GetMutableState call based on the mock expectations. This // call will fail if the mock does not expect this call. Use EXPECT to expect // a call to this function. // -// client.EXPECT().GetWorkflowExecutionNextEventID(gomock.Any(), ...).Return(...) -// ... := client.GetWorkflowExecutionNextEventID(...) -func (m *MockClient) GetWorkflowExecutionNextEventID( +// client.EXPECT().GetMutableState(gomock.Any(), ...).Return(...) +// ... := client.GetMutableState(...) +func (m *MockClient) GetMutableState( ctx context.Context, - _GetRequest *history.GetWorkflowExecutionNextEventIDRequest, + _GetRequest *history.GetMutableStateRequest, opts ...yarpc.CallOption, -) (success *history.GetWorkflowExecutionNextEventIDResponse, err error) { +) (success *history.GetMutableStateResponse, err error) { args := []interface{}{ctx, _GetRequest} for _, o := range opts { args = append(args, o) } i := 0 - ret := m.ctrl.Call(m, "GetWorkflowExecutionNextEventID", args...) - success, _ = ret[i].(*history.GetWorkflowExecutionNextEventIDResponse) + ret := m.ctrl.Call(m, "GetMutableState", args...) + success, _ = ret[i].(*history.GetMutableStateResponse) i++ err, _ = ret[i].(error) return } -func (mr *_MockClientRecorder) GetWorkflowExecutionNextEventID( +func (mr *_MockClientRecorder) GetMutableState( ctx interface{}, _GetRequest interface{}, opts ...interface{}, ) *gomock.Call { args := append([]interface{}{ctx, _GetRequest}, opts...) - return mr.mock.ctrl.RecordCall(mr.mock, "GetWorkflowExecutionNextEventID", args...) + return mr.mock.ctrl.RecordCall(mr.mock, "GetMutableState", args...) } // RecordActivityTaskHeartbeat responds to a RecordActivityTaskHeartbeat call based on the mock expectations. This diff --git a/.gen/go/history/idl.go b/.gen/go/history/idl.go index 7d8200f5de6..44a930bc822 100644 --- a/.gen/go/history/idl.go +++ b/.gen/go/history/idl.go @@ -33,11 +33,11 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "history", Package: "github.com/uber/cadence/.gen/go/history", FilePath: "history.thrift", - SHA1: "0fbf7f621994d9ca2213483f7626b21cb9486b49", + SHA1: "5e71e6e21b2962deeec8f238d6a2881e3622784e", Includes: []*thriftreflect.ThriftModule{ shared.ThriftModule, }, Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence.history\n\nexception EventAlreadyStartedError {\n 1: required string message\n}\n\nexception ShardOwnershipLostError {\n 10: optional string message\n 20: optional string owner\n}\n\nstruct ParentExecutionInfo {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") initiatedId\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.StartWorkflowExecutionRequest startRequest\n 30: optional ParentExecutionInfo parentExecutionInfo\n}\n\nstruct GetWorkflowExecutionNextEventIDRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") expectedNextEventId\n}\n\nstruct GetWorkflowExecutionNextEventIDResponse {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional string runId\n 30: optional shared.TaskList tasklist\n 40: optional bool isWorkflowRunning\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskCompletedRequest completeRequest\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskFailedRequest failedRequest\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional string domainUUID\n 20: optional shared.RecordActivityTaskHeartbeatRequest heartbeatRequest\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCompletedRequest completeRequest\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskFailedRequest failedRequest\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCanceledRequest cancelRequest\n}\n\nstruct RecordActivityTaskStartedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") scheduleId\n 40: optional i64 (js.type = \"Long\") taskId\n 45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n 50: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct RecordActivityTaskStartedResponse {\n 10: optional shared.HistoryEvent startedEvent\n 20: optional shared.HistoryEvent scheduledEvent\n}\n\nstruct RecordDecisionTaskStartedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") scheduleId\n 40: optional i64 (js.type = \"Long\") taskId\n 45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n 50: optional shared.PollForDecisionTaskRequest pollRequest\n}\n\nstruct RecordDecisionTaskStartedResponse {\n 10: optional shared.WorkflowType workflowType\n 20: optional i64 (js.type = \"Long\") previousStartedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional i64 (js.type = \"Long\") nextEventId\n 60: optional i64 (js.type = \"Long\") attempt\n 70: optional bool stickyExecutionEnabled\n 80: optional shared.TransientDecisionInfo decisionInfo\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.SignalWorkflowExecutionRequest signalRequest\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.TerminateWorkflowExecutionRequest terminateRequest\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.RequestCancelWorkflowExecutionRequest cancelRequest\n 30: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 40: optional shared.WorkflowExecution externalWorkflowExecution\n}\n\nstruct ScheduleDecisionTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.DescribeWorkflowExecutionRequest request\n}\n\n/**\n* RecordChildExecutionCompletedRequest is used for reporting the completion of child execution to parent workflow\n* execution which started it. When a child execution is completed it creates this request and calls the\n* RecordChildExecutionCompleted API with the workflowExecution of parent. It also sets the completedExecution of the\n* child as it could potentially be different than the ChildExecutionStartedEvent of parent in the situation when\n* child creates multiple runs through ContinueAsNew before finally completing.\n**/\nstruct RecordChildExecutionCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") initiatedId\n 40: optional shared.WorkflowExecution completedExecution\n 50: optional shared.HistoryEvent completionEvent\n}\n\n/**\n* HistoryService provides API to start a new long running workflow instance, as well as query and update the history\n* of workflow instances already created.\n**/\nservice HistoryService {\n /**\n * StartWorkflowExecution starts a new long running workflow instance. It will create the instance with\n * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n * first decision for this instance. It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n * exists with same workflowId.\n **/\n shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: StartWorkflowExecutionRequest startRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * Returns the nextEventID of the history of workflow execution. Only events in the history with Ids below the returned Id are\n * guaranteed to be valid, so the first step of reading an execution's history is to retrieve this event Id.\n * It fails with 'EntityNotExistError' if specified workflow execution in unknown to the service.\n **/\n GetWorkflowExecutionNextEventIDResponse GetWorkflowExecutionNextEventID(1: GetWorkflowExecutionNextEventIDRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RecordDecisionTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForDecisionTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordDecisionTaskStartedResponse RecordDecisionTaskStarted(1: RecordDecisionTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RecordActivityTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForActivityTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordActivityTaskStartedResponse RecordActivityTaskStarted(1: RecordActivityTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n * 'PollForDecisionTask' API call. Completing a DecisionTask will result in new events for the workflow execution and\n * potentially new ActivityTask being created for corresponding decisions. It will also create a DecisionTaskCompleted\n * event in the history for that session. Use the 'taskToken' provided as response of PollForDecisionTask API call\n * for completing the DecisionTask.\n **/\n void RespondDecisionTaskCompleted(1: RespondDecisionTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in\n * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be used by client to\n * either clear sticky tasklist or report ny panics during DecisionTask processing.\n **/\n void RespondDecisionTaskFailed(1: RespondDecisionTaskFailedRequest failedRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails\n * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n * 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will\n * fail with 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for heartbeating.\n **/\n shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: RecordActivityTaskHeartbeatRequest heartbeatRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCompleted(1: RespondActivityTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskFailed(1: RespondActivityTaskFailedRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will\n * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceled(1: RespondActivityTaskCanceledRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in\n * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n **/\n void SignalWorkflowExecution(1: SignalWorkflowExecutionRequest signalRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n * in the history and immediately terminating the execution instance.\n **/\n void TerminateWorkflowExecution(1: TerminateWorkflowExecutionRequest terminateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow is not valid\n * anymore due to completion or doesn't exist.\n **/\n void RequestCancelWorkflowExecution(1: RequestCancelWorkflowExecutionRequest cancelRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n )\n\n /**\n * ScheduleDecisionTask is used for creating a decision task for already started workflow execution. This is mainly\n * used by transfer queue processor during the processing of StartChildWorkflowExecution task, where it first starts\n * child execution without creating the decision task and then calls this API after updating the mutable state of\n * parent execution.\n **/\n void ScheduleDecisionTask(1: ScheduleDecisionTaskRequest scheduleRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RecordChildExecutionCompleted is used for reporting the completion of child workflow execution to parent.\n * This is mainly called by transfer queue processor during the processing of DeleteExecution task.\n **/\n void RecordChildExecutionCompleted(1: RecordChildExecutionCompletedRequest completionRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * DescribeWorkflowExecution returns information about the specified workflow execution.\n **/\n shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: DescribeWorkflowExecutionRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence.history\n\nexception EventAlreadyStartedError {\n 1: required string message\n}\n\nexception ShardOwnershipLostError {\n 10: optional string message\n 20: optional string owner\n}\n\nstruct ParentExecutionInfo {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") initiatedId\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.StartWorkflowExecutionRequest startRequest\n 30: optional ParentExecutionInfo parentExecutionInfo\n}\n\nstruct GetMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") expectedNextEventId\n}\n\nstruct GetMutableStateResponse {\n 10: optional shared.WorkflowExecution execution\n 20: optional shared.WorkflowType workflowType\n 30: optional i64 (js.type = \"Long\") NextEventId\n 40: optional i64 (js.type = \"Long\") LastFirstEventId\n 50: optional shared.TaskList taskList\n 60: optional shared.TaskList stickyTaskList\n 70: optional string clientLibraryVersion\n 80: optional string clientFeatureVersion\n 90: optional string clientImpl\n 100: optional bool isWorkflowRunning\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskCompletedRequest completeRequest\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskFailedRequest failedRequest\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional string domainUUID\n 20: optional shared.RecordActivityTaskHeartbeatRequest heartbeatRequest\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCompletedRequest completeRequest\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskFailedRequest failedRequest\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCanceledRequest cancelRequest\n}\n\nstruct RecordActivityTaskStartedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") scheduleId\n 40: optional i64 (js.type = \"Long\") taskId\n 45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n 50: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct RecordActivityTaskStartedResponse {\n 10: optional shared.HistoryEvent startedEvent\n 20: optional shared.HistoryEvent scheduledEvent\n}\n\nstruct RecordDecisionTaskStartedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") scheduleId\n 40: optional i64 (js.type = \"Long\") taskId\n 45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n 50: optional shared.PollForDecisionTaskRequest pollRequest\n}\n\nstruct RecordDecisionTaskStartedResponse {\n 10: optional shared.WorkflowType workflowType\n 20: optional i64 (js.type = \"Long\") previousStartedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional i64 (js.type = \"Long\") nextEventId\n 60: optional i64 (js.type = \"Long\") attempt\n 70: optional bool stickyExecutionEnabled\n 80: optional shared.TransientDecisionInfo decisionInfo\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.SignalWorkflowExecutionRequest signalRequest\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.TerminateWorkflowExecutionRequest terminateRequest\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.RequestCancelWorkflowExecutionRequest cancelRequest\n 30: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 40: optional shared.WorkflowExecution externalWorkflowExecution\n}\n\nstruct ScheduleDecisionTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.DescribeWorkflowExecutionRequest request\n}\n\n/**\n* RecordChildExecutionCompletedRequest is used for reporting the completion of child execution to parent workflow\n* execution which started it. When a child execution is completed it creates this request and calls the\n* RecordChildExecutionCompleted API with the workflowExecution of parent. It also sets the completedExecution of the\n* child as it could potentially be different than the ChildExecutionStartedEvent of parent in the situation when\n* child creates multiple runs through ContinueAsNew before finally completing.\n**/\nstruct RecordChildExecutionCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") initiatedId\n 40: optional shared.WorkflowExecution completedExecution\n 50: optional shared.HistoryEvent completionEvent\n}\n\n/**\n* HistoryService provides API to start a new long running workflow instance, as well as query and update the history\n* of workflow instances already created.\n**/\nservice HistoryService {\n /**\n * StartWorkflowExecution starts a new long running workflow instance. It will create the instance with\n * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n * first decision for this instance. It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n * exists with same workflowId.\n **/\n shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: StartWorkflowExecutionRequest startRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * Returns the information from mutable state of workflow execution.\n * It fails with 'EntityNotExistError' if specified workflow execution in unknown to the service.\n **/\n GetMutableStateResponse GetMutableState(1: GetMutableStateRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RecordDecisionTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForDecisionTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordDecisionTaskStartedResponse RecordDecisionTaskStarted(1: RecordDecisionTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RecordActivityTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForActivityTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordActivityTaskStartedResponse RecordActivityTaskStarted(1: RecordActivityTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n * 'PollForDecisionTask' API call. Completing a DecisionTask will result in new events for the workflow execution and\n * potentially new ActivityTask being created for corresponding decisions. It will also create a DecisionTaskCompleted\n * event in the history for that session. Use the 'taskToken' provided as response of PollForDecisionTask API call\n * for completing the DecisionTask.\n **/\n void RespondDecisionTaskCompleted(1: RespondDecisionTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in\n * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be used by client to\n * either clear sticky tasklist or report ny panics during DecisionTask processing.\n **/\n void RespondDecisionTaskFailed(1: RespondDecisionTaskFailedRequest failedRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails\n * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n * 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will\n * fail with 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for heartbeating.\n **/\n shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: RecordActivityTaskHeartbeatRequest heartbeatRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCompleted(1: RespondActivityTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskFailed(1: RespondActivityTaskFailedRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will\n * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceled(1: RespondActivityTaskCanceledRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in\n * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n **/\n void SignalWorkflowExecution(1: SignalWorkflowExecutionRequest signalRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n * in the history and immediately terminating the execution instance.\n **/\n void TerminateWorkflowExecution(1: TerminateWorkflowExecutionRequest terminateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow is not valid\n * anymore due to completion or doesn't exist.\n **/\n void RequestCancelWorkflowExecution(1: RequestCancelWorkflowExecutionRequest cancelRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n )\n\n /**\n * ScheduleDecisionTask is used for creating a decision task for already started workflow execution. This is mainly\n * used by transfer queue processor during the processing of StartChildWorkflowExecution task, where it first starts\n * child execution without creating the decision task and then calls this API after updating the mutable state of\n * parent execution.\n **/\n void ScheduleDecisionTask(1: ScheduleDecisionTaskRequest scheduleRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * RecordChildExecutionCompleted is used for reporting the completion of child workflow execution to parent.\n * This is mainly called by transfer queue processor during the processing of DeleteExecution task.\n **/\n void RecordChildExecutionCompleted(1: RecordChildExecutionCompletedRequest completionRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n /**\n * DescribeWorkflowExecution returns information about the specified workflow execution.\n **/\n shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: DescribeWorkflowExecutionRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n )\n\n}\n" diff --git a/.gen/go/history/types.go b/.gen/go/history/types.go index 51f0058ccce..7679d51a6c4 100644 --- a/.gen/go/history/types.go +++ b/.gen/go/history/types.go @@ -297,13 +297,13 @@ func (v *EventAlreadyStartedError) Error() string { return v.String() } -type GetWorkflowExecutionNextEventIDRequest struct { +type GetMutableStateRequest struct { DomainUUID *string `json:"domainUUID,omitempty"` Execution *shared.WorkflowExecution `json:"execution,omitempty"` ExpectedNextEventId *int64 `json:"expectedNextEventId,omitempty"` } -// ToWire translates a GetWorkflowExecutionNextEventIDRequest struct into a Thrift-level intermediate +// ToWire translates a GetMutableStateRequest struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -318,7 +318,7 @@ type GetWorkflowExecutionNextEventIDRequest struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *GetWorkflowExecutionNextEventIDRequest) ToWire() (wire.Value, error) { +func (v *GetMutableStateRequest) ToWire() (wire.Value, error) { var ( fields [3]wire.Field i int = 0 @@ -360,11 +360,11 @@ func _WorkflowExecution_Read(w wire.Value) (*shared.WorkflowExecution, error) { return &v, err } -// FromWire deserializes a GetWorkflowExecutionNextEventIDRequest struct from its Thrift-level +// FromWire deserializes a GetMutableStateRequest struct from its Thrift-level // representation. The Thrift-level representation may be obtained // from a ThriftRW protocol implementation. // -// An error is returned if we were unable to build a GetWorkflowExecutionNextEventIDRequest struct +// An error is returned if we were unable to build a GetMutableStateRequest struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -372,12 +372,12 @@ func _WorkflowExecution_Read(w wire.Value) (*shared.WorkflowExecution, error) { // return nil, err // } // -// var v GetWorkflowExecutionNextEventIDRequest +// var v GetMutableStateRequest // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *GetWorkflowExecutionNextEventIDRequest) FromWire(w wire.Value) error { +func (v *GetMutableStateRequest) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { @@ -416,9 +416,9 @@ func (v *GetWorkflowExecutionNextEventIDRequest) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a GetWorkflowExecutionNextEventIDRequest +// String returns a readable string representation of a GetMutableStateRequest // struct. -func (v *GetWorkflowExecutionNextEventIDRequest) String() string { +func (v *GetMutableStateRequest) String() string { if v == nil { return "" } @@ -438,7 +438,7 @@ func (v *GetWorkflowExecutionNextEventIDRequest) String() string { i++ } - return fmt.Sprintf("GetWorkflowExecutionNextEventIDRequest{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("GetMutableStateRequest{%v}", strings.Join(fields[:i], ", ")) } func _I64_EqualsPtr(lhs, rhs *int64) bool { @@ -451,11 +451,11 @@ func _I64_EqualsPtr(lhs, rhs *int64) bool { return lhs == nil && rhs == nil } -// Equals returns true if all the fields of this GetWorkflowExecutionNextEventIDRequest match the -// provided GetWorkflowExecutionNextEventIDRequest. +// Equals returns true if all the fields of this GetMutableStateRequest match the +// provided GetMutableStateRequest. // // This function performs a deep comparison. -func (v *GetWorkflowExecutionNextEventIDRequest) Equals(rhs *GetWorkflowExecutionNextEventIDRequest) bool { +func (v *GetMutableStateRequest) Equals(rhs *GetMutableStateRequest) bool { if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) { return false } @@ -471,7 +471,7 @@ func (v *GetWorkflowExecutionNextEventIDRequest) Equals(rhs *GetWorkflowExecutio // GetDomainUUID returns the value of DomainUUID if it is set or its // zero value if it is unset. -func (v *GetWorkflowExecutionNextEventIDRequest) GetDomainUUID() (o string) { +func (v *GetMutableStateRequest) GetDomainUUID() (o string) { if v.DomainUUID != nil { return *v.DomainUUID } @@ -481,7 +481,7 @@ func (v *GetWorkflowExecutionNextEventIDRequest) GetDomainUUID() (o string) { // GetExpectedNextEventId returns the value of ExpectedNextEventId if it is set or its // zero value if it is unset. -func (v *GetWorkflowExecutionNextEventIDRequest) GetExpectedNextEventId() (o int64) { +func (v *GetMutableStateRequest) GetExpectedNextEventId() (o int64) { if v.ExpectedNextEventId != nil { return *v.ExpectedNextEventId } @@ -489,14 +489,20 @@ func (v *GetWorkflowExecutionNextEventIDRequest) GetExpectedNextEventId() (o int return } -type GetWorkflowExecutionNextEventIDResponse struct { - EventId *int64 `json:"eventId,omitempty"` - RunId *string `json:"runId,omitempty"` - Tasklist *shared.TaskList `json:"tasklist,omitempty"` - IsWorkflowRunning *bool `json:"isWorkflowRunning,omitempty"` +type GetMutableStateResponse struct { + Execution *shared.WorkflowExecution `json:"execution,omitempty"` + WorkflowType *shared.WorkflowType `json:"workflowType,omitempty"` + NextEventId *int64 `json:"NextEventId,omitempty"` + LastFirstEventId *int64 `json:"LastFirstEventId,omitempty"` + TaskList *shared.TaskList `json:"taskList,omitempty"` + StickyTaskList *shared.TaskList `json:"stickyTaskList,omitempty"` + ClientLibraryVersion *string `json:"clientLibraryVersion,omitempty"` + ClientFeatureVersion *string `json:"clientFeatureVersion,omitempty"` + ClientImpl *string `json:"clientImpl,omitempty"` + IsWorkflowRunning *bool `json:"isWorkflowRunning,omitempty"` } -// ToWire translates a GetWorkflowExecutionNextEventIDResponse struct into a Thrift-level intermediate +// ToWire translates a GetMutableStateResponse struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -511,61 +517,115 @@ type GetWorkflowExecutionNextEventIDResponse struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *GetWorkflowExecutionNextEventIDResponse) ToWire() (wire.Value, error) { +func (v *GetMutableStateResponse) ToWire() (wire.Value, error) { var ( - fields [4]wire.Field + fields [10]wire.Field i int = 0 w wire.Value err error ) - if v.EventId != nil { - w, err = wire.NewValueI64(*(v.EventId)), error(nil) + if v.Execution != nil { + w, err = v.Execution.ToWire() if err != nil { return w, err } fields[i] = wire.Field{ID: 10, Value: w} i++ } - if v.RunId != nil { - w, err = wire.NewValueString(*(v.RunId)), error(nil) + if v.WorkflowType != nil { + w, err = v.WorkflowType.ToWire() if err != nil { return w, err } fields[i] = wire.Field{ID: 20, Value: w} i++ } - if v.Tasklist != nil { - w, err = v.Tasklist.ToWire() + if v.NextEventId != nil { + w, err = wire.NewValueI64(*(v.NextEventId)), error(nil) if err != nil { return w, err } fields[i] = wire.Field{ID: 30, Value: w} i++ } + if v.LastFirstEventId != nil { + w, err = wire.NewValueI64(*(v.LastFirstEventId)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 40, Value: w} + i++ + } + if v.TaskList != nil { + w, err = v.TaskList.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 50, Value: w} + i++ + } + if v.StickyTaskList != nil { + w, err = v.StickyTaskList.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 60, Value: w} + i++ + } + if v.ClientLibraryVersion != nil { + w, err = wire.NewValueString(*(v.ClientLibraryVersion)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 70, Value: w} + i++ + } + if v.ClientFeatureVersion != nil { + w, err = wire.NewValueString(*(v.ClientFeatureVersion)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 80, Value: w} + i++ + } + if v.ClientImpl != nil { + w, err = wire.NewValueString(*(v.ClientImpl)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 90, Value: w} + i++ + } if v.IsWorkflowRunning != nil { w, err = wire.NewValueBool(*(v.IsWorkflowRunning)), error(nil) if err != nil { return w, err } - fields[i] = wire.Field{ID: 40, Value: w} + fields[i] = wire.Field{ID: 100, Value: w} i++ } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } +func _WorkflowType_Read(w wire.Value) (*shared.WorkflowType, error) { + var v shared.WorkflowType + err := v.FromWire(w) + return &v, err +} + func _TaskList_Read(w wire.Value) (*shared.TaskList, error) { var v shared.TaskList err := v.FromWire(w) return &v, err } -// FromWire deserializes a GetWorkflowExecutionNextEventIDResponse struct from its Thrift-level +// FromWire deserializes a GetMutableStateResponse struct from its Thrift-level // representation. The Thrift-level representation may be obtained // from a ThriftRW protocol implementation. // -// An error is returned if we were unable to build a GetWorkflowExecutionNextEventIDResponse struct +// An error is returned if we were unable to build a GetMutableStateResponse struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -573,45 +633,99 @@ func _TaskList_Read(w wire.Value) (*shared.TaskList, error) { // return nil, err // } // -// var v GetWorkflowExecutionNextEventIDResponse +// var v GetMutableStateResponse // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *GetWorkflowExecutionNextEventIDResponse) FromWire(w wire.Value) error { +func (v *GetMutableStateResponse) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { switch field.ID { case 10: + if field.Value.Type() == wire.TStruct { + v.Execution, err = _WorkflowExecution_Read(field.Value) + if err != nil { + return err + } + + } + case 20: + if field.Value.Type() == wire.TStruct { + v.WorkflowType, err = _WorkflowType_Read(field.Value) + if err != nil { + return err + } + + } + case 30: if field.Value.Type() == wire.TI64 { var x int64 x, err = field.Value.GetI64(), error(nil) - v.EventId = &x + v.NextEventId = &x if err != nil { return err } } - case 20: + case 40: + if field.Value.Type() == wire.TI64 { + var x int64 + x, err = field.Value.GetI64(), error(nil) + v.LastFirstEventId = &x + if err != nil { + return err + } + + } + case 50: + if field.Value.Type() == wire.TStruct { + v.TaskList, err = _TaskList_Read(field.Value) + if err != nil { + return err + } + + } + case 60: + if field.Value.Type() == wire.TStruct { + v.StickyTaskList, err = _TaskList_Read(field.Value) + if err != nil { + return err + } + + } + case 70: if field.Value.Type() == wire.TBinary { var x string x, err = field.Value.GetString(), error(nil) - v.RunId = &x + v.ClientLibraryVersion = &x if err != nil { return err } } - case 30: - if field.Value.Type() == wire.TStruct { - v.Tasklist, err = _TaskList_Read(field.Value) + case 80: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.ClientFeatureVersion = &x if err != nil { return err } } - case 40: + case 90: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.ClientImpl = &x + if err != nil { + return err + } + + } + case 100: if field.Value.Type() == wire.TBool { var x bool x, err = field.Value.GetBool(), error(nil) @@ -627,25 +741,49 @@ func (v *GetWorkflowExecutionNextEventIDResponse) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a GetWorkflowExecutionNextEventIDResponse +// String returns a readable string representation of a GetMutableStateResponse // struct. -func (v *GetWorkflowExecutionNextEventIDResponse) String() string { +func (v *GetMutableStateResponse) String() string { if v == nil { return "" } - var fields [4]string + var fields [10]string i := 0 - if v.EventId != nil { - fields[i] = fmt.Sprintf("EventId: %v", *(v.EventId)) + if v.Execution != nil { + fields[i] = fmt.Sprintf("Execution: %v", v.Execution) i++ } - if v.RunId != nil { - fields[i] = fmt.Sprintf("RunId: %v", *(v.RunId)) + if v.WorkflowType != nil { + fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType) i++ } - if v.Tasklist != nil { - fields[i] = fmt.Sprintf("Tasklist: %v", v.Tasklist) + if v.NextEventId != nil { + fields[i] = fmt.Sprintf("NextEventId: %v", *(v.NextEventId)) + i++ + } + if v.LastFirstEventId != nil { + fields[i] = fmt.Sprintf("LastFirstEventId: %v", *(v.LastFirstEventId)) + i++ + } + if v.TaskList != nil { + fields[i] = fmt.Sprintf("TaskList: %v", v.TaskList) + i++ + } + if v.StickyTaskList != nil { + fields[i] = fmt.Sprintf("StickyTaskList: %v", v.StickyTaskList) + i++ + } + if v.ClientLibraryVersion != nil { + fields[i] = fmt.Sprintf("ClientLibraryVersion: %v", *(v.ClientLibraryVersion)) + i++ + } + if v.ClientFeatureVersion != nil { + fields[i] = fmt.Sprintf("ClientFeatureVersion: %v", *(v.ClientFeatureVersion)) + i++ + } + if v.ClientImpl != nil { + fields[i] = fmt.Sprintf("ClientImpl: %v", *(v.ClientImpl)) i++ } if v.IsWorkflowRunning != nil { @@ -653,7 +791,7 @@ func (v *GetWorkflowExecutionNextEventIDResponse) String() string { i++ } - return fmt.Sprintf("GetWorkflowExecutionNextEventIDResponse{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("GetMutableStateResponse{%v}", strings.Join(fields[:i], ", ")) } func _Bool_EqualsPtr(lhs, rhs *bool) bool { @@ -666,18 +804,36 @@ func _Bool_EqualsPtr(lhs, rhs *bool) bool { return lhs == nil && rhs == nil } -// Equals returns true if all the fields of this GetWorkflowExecutionNextEventIDResponse match the -// provided GetWorkflowExecutionNextEventIDResponse. +// Equals returns true if all the fields of this GetMutableStateResponse match the +// provided GetMutableStateResponse. // // This function performs a deep comparison. -func (v *GetWorkflowExecutionNextEventIDResponse) Equals(rhs *GetWorkflowExecutionNextEventIDResponse) bool { - if !_I64_EqualsPtr(v.EventId, rhs.EventId) { +func (v *GetMutableStateResponse) Equals(rhs *GetMutableStateResponse) bool { + if !((v.Execution == nil && rhs.Execution == nil) || (v.Execution != nil && rhs.Execution != nil && v.Execution.Equals(rhs.Execution))) { return false } - if !_String_EqualsPtr(v.RunId, rhs.RunId) { + if !((v.WorkflowType == nil && rhs.WorkflowType == nil) || (v.WorkflowType != nil && rhs.WorkflowType != nil && v.WorkflowType.Equals(rhs.WorkflowType))) { + return false + } + if !_I64_EqualsPtr(v.NextEventId, rhs.NextEventId) { + return false + } + if !_I64_EqualsPtr(v.LastFirstEventId, rhs.LastFirstEventId) { return false } - if !((v.Tasklist == nil && rhs.Tasklist == nil) || (v.Tasklist != nil && rhs.Tasklist != nil && v.Tasklist.Equals(rhs.Tasklist))) { + if !((v.TaskList == nil && rhs.TaskList == nil) || (v.TaskList != nil && rhs.TaskList != nil && v.TaskList.Equals(rhs.TaskList))) { + return false + } + if !((v.StickyTaskList == nil && rhs.StickyTaskList == nil) || (v.StickyTaskList != nil && rhs.StickyTaskList != nil && v.StickyTaskList.Equals(rhs.StickyTaskList))) { + return false + } + if !_String_EqualsPtr(v.ClientLibraryVersion, rhs.ClientLibraryVersion) { + return false + } + if !_String_EqualsPtr(v.ClientFeatureVersion, rhs.ClientFeatureVersion) { + return false + } + if !_String_EqualsPtr(v.ClientImpl, rhs.ClientImpl) { return false } if !_Bool_EqualsPtr(v.IsWorkflowRunning, rhs.IsWorkflowRunning) { @@ -687,21 +843,51 @@ func (v *GetWorkflowExecutionNextEventIDResponse) Equals(rhs *GetWorkflowExecuti return true } -// GetEventId returns the value of EventId if it is set or its +// GetNextEventId returns the value of NextEventId if it is set or its // zero value if it is unset. -func (v *GetWorkflowExecutionNextEventIDResponse) GetEventId() (o int64) { - if v.EventId != nil { - return *v.EventId +func (v *GetMutableStateResponse) GetNextEventId() (o int64) { + if v.NextEventId != nil { + return *v.NextEventId } return } -// GetRunId returns the value of RunId if it is set or its +// GetLastFirstEventId returns the value of LastFirstEventId if it is set or its // zero value if it is unset. -func (v *GetWorkflowExecutionNextEventIDResponse) GetRunId() (o string) { - if v.RunId != nil { - return *v.RunId +func (v *GetMutableStateResponse) GetLastFirstEventId() (o int64) { + if v.LastFirstEventId != nil { + return *v.LastFirstEventId + } + + return +} + +// GetClientLibraryVersion returns the value of ClientLibraryVersion if it is set or its +// zero value if it is unset. +func (v *GetMutableStateResponse) GetClientLibraryVersion() (o string) { + if v.ClientLibraryVersion != nil { + return *v.ClientLibraryVersion + } + + return +} + +// GetClientFeatureVersion returns the value of ClientFeatureVersion if it is set or its +// zero value if it is unset. +func (v *GetMutableStateResponse) GetClientFeatureVersion() (o string) { + if v.ClientFeatureVersion != nil { + return *v.ClientFeatureVersion + } + + return +} + +// GetClientImpl returns the value of ClientImpl if it is set or its +// zero value if it is unset. +func (v *GetMutableStateResponse) GetClientImpl() (o string) { + if v.ClientImpl != nil { + return *v.ClientImpl } return @@ -709,7 +895,7 @@ func (v *GetWorkflowExecutionNextEventIDResponse) GetRunId() (o string) { // GetIsWorkflowRunning returns the value of IsWorkflowRunning if it is set or its // zero value if it is unset. -func (v *GetWorkflowExecutionNextEventIDResponse) GetIsWorkflowRunning() (o bool) { +func (v *GetMutableStateResponse) GetIsWorkflowRunning() (o bool) { if v.IsWorkflowRunning != nil { return *v.IsWorkflowRunning } @@ -2060,12 +2246,6 @@ func (v *RecordDecisionTaskStartedResponse) ToWire() (wire.Value, error) { return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _WorkflowType_Read(w wire.Value) (*shared.WorkflowType, error) { - var v shared.WorkflowType - err := v.FromWire(w) - return &v, err -} - func _TransientDecisionInfo_Read(w wire.Value) (*shared.TransientDecisionInfo, error) { var v shared.TransientDecisionInfo err := v.FromWire(w) diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index c2eb039c69a..bbf50b7f85d 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "c8496bb37909935e3018e10fa9a14c7492bc8bcf", + SHA1: "061e5d77656c005af99aa473b47809cc1c0247ab", Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n 50: optional TaskList stickyTaskList\n 60: optional i32 stickyScheduleToStartTimeoutSeconds\n 70: optional string clientLibraryVersion\n 80: optional string clientFeatureVersion\n 90: optional string clientLang\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional string identity\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional string identity\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domainID\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index bc7948a41b3..51b3444e560 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -23098,11 +23098,6 @@ type WorkflowExecutionConfiguration struct { ExecutionStartToCloseTimeoutSeconds *int32 `json:"executionStartToCloseTimeoutSeconds,omitempty"` TaskStartToCloseTimeoutSeconds *int32 `json:"taskStartToCloseTimeoutSeconds,omitempty"` ChildPolicy *ChildPolicy `json:"childPolicy,omitempty"` - StickyTaskList *TaskList `json:"stickyTaskList,omitempty"` - StickyScheduleToStartTimeoutSeconds *int32 `json:"stickyScheduleToStartTimeoutSeconds,omitempty"` - ClientLibraryVersion *string `json:"clientLibraryVersion,omitempty"` - ClientFeatureVersion *string `json:"clientFeatureVersion,omitempty"` - ClientLang *string `json:"clientLang,omitempty"` } // ToWire translates a WorkflowExecutionConfiguration struct into a Thrift-level intermediate @@ -23122,7 +23117,7 @@ type WorkflowExecutionConfiguration struct { // } func (v *WorkflowExecutionConfiguration) ToWire() (wire.Value, error) { var ( - fields [9]wire.Field + fields [4]wire.Field i int = 0 w wire.Value err error @@ -23160,46 +23155,6 @@ func (v *WorkflowExecutionConfiguration) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 40, Value: w} i++ } - if v.StickyTaskList != nil { - w, err = v.StickyTaskList.ToWire() - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 50, Value: w} - i++ - } - if v.StickyScheduleToStartTimeoutSeconds != nil { - w, err = wire.NewValueI32(*(v.StickyScheduleToStartTimeoutSeconds)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 60, Value: w} - i++ - } - if v.ClientLibraryVersion != nil { - w, err = wire.NewValueString(*(v.ClientLibraryVersion)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 70, Value: w} - i++ - } - if v.ClientFeatureVersion != nil { - w, err = wire.NewValueString(*(v.ClientFeatureVersion)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 80, Value: w} - i++ - } - if v.ClientLang != nil { - w, err = wire.NewValueString(*(v.ClientLang)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 90, Value: w} - i++ - } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -23263,54 +23218,6 @@ func (v *WorkflowExecutionConfiguration) FromWire(w wire.Value) error { return err } - } - case 50: - if field.Value.Type() == wire.TStruct { - v.StickyTaskList, err = _TaskList_Read(field.Value) - if err != nil { - return err - } - - } - case 60: - if field.Value.Type() == wire.TI32 { - var x int32 - x, err = field.Value.GetI32(), error(nil) - v.StickyScheduleToStartTimeoutSeconds = &x - if err != nil { - return err - } - - } - case 70: - if field.Value.Type() == wire.TBinary { - var x string - x, err = field.Value.GetString(), error(nil) - v.ClientLibraryVersion = &x - if err != nil { - return err - } - - } - case 80: - if field.Value.Type() == wire.TBinary { - var x string - x, err = field.Value.GetString(), error(nil) - v.ClientFeatureVersion = &x - if err != nil { - return err - } - - } - case 90: - if field.Value.Type() == wire.TBinary { - var x string - x, err = field.Value.GetString(), error(nil) - v.ClientLang = &x - if err != nil { - return err - } - } } } @@ -23325,7 +23232,7 @@ func (v *WorkflowExecutionConfiguration) String() string { return "" } - var fields [9]string + var fields [4]string i := 0 if v.TaskList != nil { fields[i] = fmt.Sprintf("TaskList: %v", v.TaskList) @@ -23343,26 +23250,6 @@ func (v *WorkflowExecutionConfiguration) String() string { fields[i] = fmt.Sprintf("ChildPolicy: %v", *(v.ChildPolicy)) i++ } - if v.StickyTaskList != nil { - fields[i] = fmt.Sprintf("StickyTaskList: %v", v.StickyTaskList) - i++ - } - if v.StickyScheduleToStartTimeoutSeconds != nil { - fields[i] = fmt.Sprintf("StickyScheduleToStartTimeoutSeconds: %v", *(v.StickyScheduleToStartTimeoutSeconds)) - i++ - } - if v.ClientLibraryVersion != nil { - fields[i] = fmt.Sprintf("ClientLibraryVersion: %v", *(v.ClientLibraryVersion)) - i++ - } - if v.ClientFeatureVersion != nil { - fields[i] = fmt.Sprintf("ClientFeatureVersion: %v", *(v.ClientFeatureVersion)) - i++ - } - if v.ClientLang != nil { - fields[i] = fmt.Sprintf("ClientLang: %v", *(v.ClientLang)) - i++ - } return fmt.Sprintf("WorkflowExecutionConfiguration{%v}", strings.Join(fields[:i], ", ")) } @@ -23384,21 +23271,6 @@ func (v *WorkflowExecutionConfiguration) Equals(rhs *WorkflowExecutionConfigurat if !_ChildPolicy_EqualsPtr(v.ChildPolicy, rhs.ChildPolicy) { return false } - if !((v.StickyTaskList == nil && rhs.StickyTaskList == nil) || (v.StickyTaskList != nil && rhs.StickyTaskList != nil && v.StickyTaskList.Equals(rhs.StickyTaskList))) { - return false - } - if !_I32_EqualsPtr(v.StickyScheduleToStartTimeoutSeconds, rhs.StickyScheduleToStartTimeoutSeconds) { - return false - } - if !_String_EqualsPtr(v.ClientLibraryVersion, rhs.ClientLibraryVersion) { - return false - } - if !_String_EqualsPtr(v.ClientFeatureVersion, rhs.ClientFeatureVersion) { - return false - } - if !_String_EqualsPtr(v.ClientLang, rhs.ClientLang) { - return false - } return true } @@ -23433,46 +23305,6 @@ func (v *WorkflowExecutionConfiguration) GetChildPolicy() (o ChildPolicy) { return } -// GetStickyScheduleToStartTimeoutSeconds returns the value of StickyScheduleToStartTimeoutSeconds if it is set or its -// zero value if it is unset. -func (v *WorkflowExecutionConfiguration) GetStickyScheduleToStartTimeoutSeconds() (o int32) { - if v.StickyScheduleToStartTimeoutSeconds != nil { - return *v.StickyScheduleToStartTimeoutSeconds - } - - return -} - -// GetClientLibraryVersion returns the value of ClientLibraryVersion if it is set or its -// zero value if it is unset. -func (v *WorkflowExecutionConfiguration) GetClientLibraryVersion() (o string) { - if v.ClientLibraryVersion != nil { - return *v.ClientLibraryVersion - } - - return -} - -// GetClientFeatureVersion returns the value of ClientFeatureVersion if it is set or its -// zero value if it is unset. -func (v *WorkflowExecutionConfiguration) GetClientFeatureVersion() (o string) { - if v.ClientFeatureVersion != nil { - return *v.ClientFeatureVersion - } - - return -} - -// GetClientLang returns the value of ClientLang if it is set or its -// zero value if it is unset. -func (v *WorkflowExecutionConfiguration) GetClientLang() (o string) { - if v.ClientLang != nil { - return *v.ClientLang - } - - return -} - type WorkflowExecutionContinuedAsNewEventAttributes struct { NewExecutionRunId *string `json:"newExecutionRunId,omitempty"` WorkflowType *WorkflowType `json:"workflowType,omitempty"` diff --git a/client/history/client.go b/client/history/client.go index acbe9267058..3eda2167904 100644 --- a/client/history/client.go +++ b/client/history/client.go @@ -70,6 +70,7 @@ func (c *clientImpl) StartWorkflowExecution( if err != nil { return nil, err } + opts = aggregateYarpcOptions(ctx, opts...) var response *workflow.StartWorkflowExecutionResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -85,20 +86,21 @@ func (c *clientImpl) StartWorkflowExecution( return response, nil } -func (c *clientImpl) GetWorkflowExecutionNextEventID( +func (c *clientImpl) GetMutableState( ctx context.Context, - request *h.GetWorkflowExecutionNextEventIDRequest, - opts ...yarpc.CallOption) (*h.GetWorkflowExecutionNextEventIDResponse, error) { + request *h.GetMutableStateRequest, + opts ...yarpc.CallOption) (*h.GetMutableStateResponse, error) { client, err := c.getHostForRequest(*request.Execution.WorkflowId) if err != nil { return nil, err } - var response *h.GetWorkflowExecutionNextEventIDResponse + opts = aggregateYarpcOptions(ctx, opts...) + var response *h.GetMutableStateResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error ctx, cancel := c.createContext(ctx) defer cancel() - response, err = client.GetWorkflowExecutionNextEventID(ctx, request, opts...) + response, err = client.GetMutableState(ctx, request, opts...) return err } err = c.executeWithRedirect(ctx, client, op) @@ -116,6 +118,7 @@ func (c *clientImpl) DescribeWorkflowExecution( if err != nil { return nil, err } + opts = aggregateYarpcOptions(ctx, opts...) var response *workflow.DescribeWorkflowExecutionResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -139,6 +142,7 @@ func (c *clientImpl) RecordDecisionTaskStarted( if err != nil { return nil, err } + opts = aggregateYarpcOptions(ctx, opts...) var response *h.RecordDecisionTaskStartedResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -162,6 +166,7 @@ func (c *clientImpl) RecordActivityTaskStarted( if err != nil { return nil, err } + opts = aggregateYarpcOptions(ctx, opts...) var response *h.RecordActivityTaskStartedResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -189,6 +194,7 @@ func (c *clientImpl) RespondDecisionTaskCompleted( if err != nil { return err } + opts = aggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -210,6 +216,7 @@ func (c *clientImpl) RespondDecisionTaskFailed( if err != nil { return err } + opts = aggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -231,6 +238,7 @@ func (c *clientImpl) RespondActivityTaskCompleted( if err != nil { return err } + opts = aggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -252,6 +260,7 @@ func (c *clientImpl) RespondActivityTaskFailed( if err != nil { return err } + opts = aggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -273,6 +282,7 @@ func (c *clientImpl) RespondActivityTaskCanceled( if err != nil { return err } + opts = aggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -294,6 +304,7 @@ func (c *clientImpl) RecordActivityTaskHeartbeat( if err != nil { return nil, err } + opts = aggregateYarpcOptions(ctx, opts...) var response *workflow.RecordActivityTaskHeartbeatResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -317,6 +328,7 @@ func (c *clientImpl) RequestCancelWorkflowExecution( if err != nil { return err } + opts = aggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -333,6 +345,7 @@ func (c *clientImpl) SignalWorkflowExecution( if err != nil { return err } + opts = aggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -351,6 +364,7 @@ func (c *clientImpl) TerminateWorkflowExecution( if err != nil { return err } + opts = aggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -368,6 +382,7 @@ func (c *clientImpl) ScheduleDecisionTask( if err != nil { return err } + opts = aggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -385,6 +400,7 @@ func (c *clientImpl) RecordChildExecutionCompleted( if err != nil { return err } + opts = aggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -460,3 +476,16 @@ redirectLoop: } return err } + +func aggregateYarpcOptions(ctx context.Context, opts ...yarpc.CallOption) []yarpc.CallOption { + var result []yarpc.CallOption + if ctx != nil { + call := yarpc.CallFromContext(ctx) + for _, key := range call.HeaderNames() { + value := call.Header(key) + result = append(result, yarpc.WithHeader(key, value)) + } + result = append(result, opts...) + } + return result +} diff --git a/client/history/metricClient.go b/client/history/metricClient.go index 7e7e3d50b32..66879613bda 100644 --- a/client/history/metricClient.go +++ b/client/history/metricClient.go @@ -61,18 +61,18 @@ func (c *metricClient) StartWorkflowExecution( return resp, err } -func (c *metricClient) GetWorkflowExecutionNextEventID( +func (c *metricClient) GetMutableState( context context.Context, - request *h.GetWorkflowExecutionNextEventIDRequest, - opts ...yarpc.CallOption) (*h.GetWorkflowExecutionNextEventIDResponse, error) { - c.metricsClient.IncCounter(metrics.HistoryClientGetWorkflowExecutionNextEventIDScope, metrics.CadenceRequests) + request *h.GetMutableStateRequest, + opts ...yarpc.CallOption) (*h.GetMutableStateResponse, error) { + c.metricsClient.IncCounter(metrics.HistoryClientGetMutableStateScope, metrics.CadenceRequests) - sw := c.metricsClient.StartTimer(metrics.HistoryClientGetWorkflowExecutionNextEventIDScope, metrics.CadenceLatency) - resp, err := c.client.GetWorkflowExecutionNextEventID(context, request, opts...) + sw := c.metricsClient.StartTimer(metrics.HistoryClientGetMutableStateScope, metrics.CadenceLatency) + resp, err := c.client.GetMutableState(context, request, opts...) sw.Stop() if err != nil { - c.metricsClient.IncCounter(metrics.HistoryClientGetWorkflowExecutionNextEventIDScope, metrics.CadenceFailures) + c.metricsClient.IncCounter(metrics.HistoryClientGetMutableStateScope, metrics.CadenceFailures) } return resp, err diff --git a/client/matching/client.go b/client/matching/client.go index 63b1295aefe..1b4372e60e6 100644 --- a/client/matching/client.go +++ b/client/matching/client.go @@ -58,85 +58,92 @@ func NewClient(d common.RPCFactory, monitor membership.Monitor) (Client, error) } func (c *clientImpl) AddActivityTask( - context context.Context, + ctx context.Context, addRequest *m.AddActivityTaskRequest, opts ...yarpc.CallOption) error { + opts = aggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*addRequest.TaskList.Name) if err != nil { return err } - ctx, cancel := c.createContext(context) + ctx, cancel := c.createContext(ctx) defer cancel() - return client.AddActivityTask(ctx, addRequest) + return client.AddActivityTask(ctx, addRequest, opts...) } func (c *clientImpl) AddDecisionTask( - context context.Context, + ctx context.Context, addRequest *m.AddDecisionTaskRequest, opts ...yarpc.CallOption) error { + opts = aggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*addRequest.TaskList.Name) if err != nil { return err } - ctx, cancel := c.createContext(context) + ctx, cancel := c.createContext(ctx) defer cancel() - return client.AddDecisionTask(ctx, addRequest) + return client.AddDecisionTask(ctx, addRequest, opts...) } func (c *clientImpl) PollForActivityTask( - context context.Context, + ctx context.Context, pollRequest *m.PollForActivityTaskRequest, opts ...yarpc.CallOption) (*workflow.PollForActivityTaskResponse, error) { + opts = aggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*pollRequest.PollRequest.TaskList.Name) if err != nil { return nil, err } - ctx, cancel := c.createLongPollContext(context) + ctx, cancel := c.createLongPollContext(ctx) defer cancel() - return client.PollForActivityTask(ctx, pollRequest) + return client.PollForActivityTask(ctx, pollRequest, opts...) } func (c *clientImpl) PollForDecisionTask( - context context.Context, + ctx context.Context, pollRequest *m.PollForDecisionTaskRequest, opts ...yarpc.CallOption) (*m.PollForDecisionTaskResponse, error) { + opts = aggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*pollRequest.PollRequest.TaskList.Name) if err != nil { return nil, err } - ctx, cancel := c.createLongPollContext(context) + ctx, cancel := c.createLongPollContext(ctx) defer cancel() - return client.PollForDecisionTask(ctx, pollRequest) + return client.PollForDecisionTask(ctx, pollRequest, opts...) } func (c *clientImpl) QueryWorkflow(ctx context.Context, queryRequest *m.QueryWorkflowRequest, opts ...yarpc.CallOption) (*workflow.QueryWorkflowResponse, error) { + opts = aggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*queryRequest.TaskList.Name) if err != nil { return nil, err } ctx, cancel := c.createContext(ctx) defer cancel() - return client.QueryWorkflow(ctx, queryRequest) + return client.QueryWorkflow(ctx, queryRequest, opts...) } func (c *clientImpl) RespondQueryTaskCompleted(ctx context.Context, request *m.RespondQueryTaskCompletedRequest, opts ...yarpc.CallOption) error { + opts = aggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*request.TaskList.Name) if err != nil { return err } ctx, cancel := c.createContext(ctx) defer cancel() - return client.RespondQueryTaskCompleted(ctx, request) + return client.RespondQueryTaskCompleted(ctx, request, opts...) } func (c *clientImpl) CancelOutstandingPoll(ctx context.Context, request *m.CancelOutstandingPollRequest, opts ...yarpc.CallOption) error { + opts = aggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*request.TaskList.Name) if err != nil { return err } ctx, cancel := c.createContext(ctx) defer cancel() - return client.CancelOutstandingPoll(ctx, request) + return client.CancelOutstandingPoll(ctx, request, opts...) } func (c *clientImpl) getHostForRequest(key string) (matchingserviceclient.Interface, error) { @@ -187,3 +194,16 @@ func (c *clientImpl) getThriftClient(hostPort string) matchingserviceclient.Inte } return client } + +func aggregateYarpcOptions(ctx context.Context, opts ...yarpc.CallOption) []yarpc.CallOption { + var result []yarpc.CallOption + if ctx != nil { + call := yarpc.CallFromContext(ctx) + for _, key := range call.HeaderNames() { + value := call.Header(key) + result = append(result, yarpc.WithHeader(key, value)) + } + } + result = append(result, opts...) + return result +} diff --git a/client/matching/metricClient.go b/client/matching/metricClient.go index 92216b2145e..7caa8c9dbb2 100644 --- a/client/matching/metricClient.go +++ b/client/matching/metricClient.go @@ -45,13 +45,13 @@ func NewMetricClient(client Client, metricsClient metrics.Client) Client { } func (c *metricClient) AddActivityTask( - context context.Context, + ctx context.Context, addRequest *m.AddActivityTaskRequest, opts ...yarpc.CallOption) error { c.metricsClient.IncCounter(metrics.MatchingClientAddActivityTaskScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.MatchingClientAddActivityTaskScope, metrics.CadenceLatency) - err := c.client.AddActivityTask(context, addRequest) + err := c.client.AddActivityTask(ctx, addRequest, opts...) sw.Stop() if err != nil { @@ -62,13 +62,13 @@ func (c *metricClient) AddActivityTask( } func (c *metricClient) AddDecisionTask( - context context.Context, + ctx context.Context, addRequest *m.AddDecisionTaskRequest, opts ...yarpc.CallOption) error { c.metricsClient.IncCounter(metrics.MatchingClientAddDecisionTaskScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.MatchingClientAddDecisionTaskScope, metrics.CadenceLatency) - err := c.client.AddDecisionTask(context, addRequest) + err := c.client.AddDecisionTask(ctx, addRequest, opts...) sw.Stop() if err != nil { @@ -79,13 +79,13 @@ func (c *metricClient) AddDecisionTask( } func (c *metricClient) PollForActivityTask( - context context.Context, + ctx context.Context, pollRequest *m.PollForActivityTaskRequest, opts ...yarpc.CallOption) (*workflow.PollForActivityTaskResponse, error) { c.metricsClient.IncCounter(metrics.MatchingClientPollForActivityTaskScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.MatchingClientPollForActivityTaskScope, metrics.CadenceLatency) - resp, err := c.client.PollForActivityTask(context, pollRequest) + resp, err := c.client.PollForActivityTask(ctx, pollRequest, opts...) sw.Stop() if err != nil { @@ -96,13 +96,13 @@ func (c *metricClient) PollForActivityTask( } func (c *metricClient) PollForDecisionTask( - context context.Context, + ctx context.Context, pollRequest *m.PollForDecisionTaskRequest, opts ...yarpc.CallOption) (*m.PollForDecisionTaskResponse, error) { c.metricsClient.IncCounter(metrics.MatchingClientPollForDecisionTaskScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.MatchingClientPollForDecisionTaskScope, metrics.CadenceLatency) - resp, err := c.client.PollForDecisionTask(context, pollRequest) + resp, err := c.client.PollForDecisionTask(ctx, pollRequest, opts...) sw.Stop() if err != nil { @@ -119,7 +119,7 @@ func (c *metricClient) QueryWorkflow( c.metricsClient.IncCounter(metrics.MatchingClientQueryWorkflowScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.MatchingClientQueryWorkflowScope, metrics.CadenceLatency) - resp, err := c.client.QueryWorkflow(ctx, queryRequest) + resp, err := c.client.QueryWorkflow(ctx, queryRequest, opts...) sw.Stop() if err != nil { @@ -136,7 +136,7 @@ func (c *metricClient) RespondQueryTaskCompleted( c.metricsClient.IncCounter(metrics.MatchingClientRespondQueryTaskCompletedScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.MatchingClientRespondQueryTaskCompletedScope, metrics.CadenceLatency) - err := c.client.RespondQueryTaskCompleted(ctx, request) + err := c.client.RespondQueryTaskCompleted(ctx, request, opts...) sw.Stop() if err != nil { @@ -153,7 +153,7 @@ func (c *metricClient) CancelOutstandingPoll( c.metricsClient.IncCounter(metrics.MatchingClientCancelOutstandingPollScope, metrics.CadenceRequests) sw := c.metricsClient.StartTimer(metrics.MatchingClientCancelOutstandingPollScope, metrics.CadenceLatency) - err := c.client.CancelOutstandingPoll(ctx, request) + err := c.client.CancelOutstandingPoll(ctx, request, opts...) sw.Stop() if err != nil { diff --git a/common/client/clientFeature.go b/common/client/clientFeature.go index af9f26bd2d6..81b924a3a3c 100644 --- a/common/client/clientFeature.go +++ b/common/client/clientFeature.go @@ -22,13 +22,19 @@ package client import ( "strconv" + "strings" ) const ( intBase = 10 intBitSize = 32 + + versionDelim = "." + versionLen = 3 ) +var defaultVersion = version{0, 0, 0} + type ( // Feature provides information about client's capibility Feature interface { @@ -39,25 +45,59 @@ type ( // This can be useful when service support a feature, while // client does not, so we can use be backward comparible FeatureImpl struct { - libVersion string - featureVersion int + libVersion version + featureVersion version lang string } + + version struct { + major int64 + minor int64 + patch int64 + } ) // NewFeatureImpl make a new NewFeatureImpl +// libVersion and featureVersion, will be both of format MAJOR.MINOR.PATCH func NewFeatureImpl(libVersion string, featureVersion string, lang string) *FeatureImpl { impl := &FeatureImpl{ - libVersion: libVersion, - lang: lang, - } - if feature, err := strconv.ParseInt(featureVersion, intBase, intBitSize); err == nil { - impl.featureVersion = int(feature) + libVersion: parseVersion(libVersion), + featureVersion: parseVersion(featureVersion), + lang: lang, } + return impl } // SupportStickyQuery whether a client support sticky query func (feature *FeatureImpl) SupportStickyQuery() bool { - return feature.featureVersion > 0 + return feature.featureVersion.major > 0 +} + +func parseVersion(versionStr string) version { + var major int64 + var minor int64 + var patch int64 + var err error + versions := strings.Split(versionStr, versionDelim) + + if len(versions) != versionLen { + // for any random input version, just assume default + return defaultVersion + } + + if major, err = strconv.ParseInt(versions[0], intBase, intBitSize); err != nil { + return defaultVersion + } + + if minor, err = strconv.ParseInt(versions[1], intBase, intBitSize); err != nil { + return defaultVersion + } + + if patch, err = strconv.ParseInt(versions[2], intBase, intBitSize); err != nil { + return defaultVersion + } + + return version{major, minor, patch} + } diff --git a/common/client/clientFeature_test.go b/common/client/clientFeature_test.go index eb2c2a06edd..aa3fe463180 100644 --- a/common/client/clientFeature_test.go +++ b/common/client/clientFeature_test.go @@ -43,8 +43,8 @@ func (s *FeatureSuite) SetupTest() { } func (s *FeatureSuite) TestSupportStickyQuery() { - libVersion := "lib ver" - featureVersion := "1" + libVersion := "0.5.0" + featureVersion := "1.0.0" lang := "go" feature := NewFeatureImpl(libVersion, featureVersion, lang) s.True(feature.SupportStickyQuery(), "Should support sticky query") @@ -53,5 +53,5 @@ func (s *FeatureSuite) TestSupportStickyQuery() { featureVersion = "" lang = "" feature = NewFeatureImpl(libVersion, featureVersion, lang) - s.False(feature.SupportStickyQuery(), "Should support sticky query") + s.False(feature.SupportStickyQuery(), "Should not support sticky query") } diff --git a/common/metrics/defs.go b/common/metrics/defs.go index fa3d9774285..f44c5686056 100644 --- a/common/metrics/defs.go +++ b/common/metrics/defs.go @@ -175,8 +175,8 @@ const ( HistoryClientRespondActivityTaskFailedScope // HistoryClientRespondActivityTaskCanceledScope tracks RPC calls to history service HistoryClientRespondActivityTaskCanceledScope - // HistoryClientGetWorkflowExecutionNextEventIDScope tracks RPC calls to history service - HistoryClientGetWorkflowExecutionNextEventIDScope + // HistoryClientGetMutableStateScope tracks RPC calls to history service + HistoryClientGetMutableStateScope // HistoryClientDescribeWorkflowExecutionScope tracks RPC calls to history service HistoryClientDescribeWorkflowExecutionScope // HistoryClientRecordDecisionTaskStartedScope tracks RPC calls to history service @@ -283,8 +283,8 @@ const ( HistoryRespondActivityTaskFailedScope // HistoryRespondActivityTaskCanceledScope tracks RespondActivityTaskCanceled API calls received by service HistoryRespondActivityTaskCanceledScope - // HistoryGetWorkflowExecutionNextEventIDScope tracks GetWorkflowExecutionHistory API calls received by service - HistoryGetWorkflowExecutionNextEventIDScope + // HistoryGetMutableStateScope tracks GetWorkflowExecutionHistory API calls received by service + HistoryGetMutableStateScope // HistoryDescribeWorkflowExecutionScope tracks DescribeWorkflowExecution API calls received by service HistoryDescribeWorkflowExecutionScope // HistoryRecordDecisionTaskStartedScope tracks RecordDecisionTaskStarted API calls received by service @@ -385,29 +385,29 @@ var ScopeDefs = map[ServiceIdx]map[int]scopeDefinition{ PersistenceDeleteDomainScope: {operation: "DeleteDomain", tags: map[string]string{ShardTagName: NoneShardsTagValue}}, PersistenceDeleteDomainByNameScope: {operation: "DeleteDomainByName", tags: map[string]string{ShardTagName: NoneShardsTagValue}}, - HistoryClientStartWorkflowExecutionScope: {operation: "HistoryClientStartWorkflowExecution"}, - HistoryClientRecordActivityTaskHeartbeatScope: {operation: "HistoryClientRecordActivityTaskHeartbeat"}, - HistoryClientRespondDecisionTaskCompletedScope: {operation: "HistoryClientRespondDecisionTaskCompleted"}, - HistoryClientRespondDecisionTaskFailedScope: {operation: "HistoryClientRespondDecisionTaskFailed"}, - HistoryClientRespondActivityTaskCompletedScope: {operation: "HistoryClientRespondActivityTaskCompleted"}, - HistoryClientRespondActivityTaskFailedScope: {operation: "HistoryClientRespondActivityTaskFailed"}, - HistoryClientRespondActivityTaskCanceledScope: {operation: "HistoryClientRespondActivityTaskCanceled"}, - HistoryClientGetWorkflowExecutionNextEventIDScope: {operation: "HistoryClientGetWorkflowExecutionNextEventId"}, - HistoryClientDescribeWorkflowExecutionScope: {operation: "HistoryClientDescribeWorkflowExecution"}, - HistoryClientRecordDecisionTaskStartedScope: {operation: "HistoryClientRecordDecisionTaskStarted"}, - HistoryClientRecordActivityTaskStartedScope: {operation: "HistoryClientRecordActivityTaskStarted"}, - HistoryClientRequestCancelWorkflowExecutionScope: {operation: "HistoryClientRequestCancelWorkflowExecution"}, - HistoryClientSignalWorkflowExecutionScope: {operation: "HistoryClientSignalWorkflowExecution"}, - HistoryClientTerminateWorkflowExecutionScope: {operation: "HistoryClientTerminateWorkflowExecution"}, - HistoryClientScheduleDecisionTaskScope: {operation: "HistoryClientScheduleDecisionTask"}, - HistoryClientRecordChildExecutionCompletedScope: {operation: "HistoryClientRecordChildExecutionCompleted"}, - MatchingClientPollForDecisionTaskScope: {operation: "MatchingClientPollForDecisionTask"}, - MatchingClientPollForActivityTaskScope: {operation: "MatchingClientPollForActivityTask"}, - MatchingClientAddActivityTaskScope: {operation: "MatchingClientAddActivityTask"}, - MatchingClientAddDecisionTaskScope: {operation: "MatchingClientAddDecisionTask"}, - MatchingClientQueryWorkflowScope: {operation: "MatchingClientQueryWorkflow"}, - MatchingClientRespondQueryTaskCompletedScope: {operation: "MatchingClientRespondQueryTaskCompleted"}, - MatchingClientCancelOutstandingPollScope: {operation: "MatchingClientCancelOutstandingPoll"}, + HistoryClientStartWorkflowExecutionScope: {operation: "HistoryClientStartWorkflowExecution"}, + HistoryClientRecordActivityTaskHeartbeatScope: {operation: "HistoryClientRecordActivityTaskHeartbeat"}, + HistoryClientRespondDecisionTaskCompletedScope: {operation: "HistoryClientRespondDecisionTaskCompleted"}, + HistoryClientRespondDecisionTaskFailedScope: {operation: "HistoryClientRespondDecisionTaskFailed"}, + HistoryClientRespondActivityTaskCompletedScope: {operation: "HistoryClientRespondActivityTaskCompleted"}, + HistoryClientRespondActivityTaskFailedScope: {operation: "HistoryClientRespondActivityTaskFailed"}, + HistoryClientRespondActivityTaskCanceledScope: {operation: "HistoryClientRespondActivityTaskCanceled"}, + HistoryClientGetMutableStateScope: {operation: "HistoryClientGetMutableState"}, + HistoryClientDescribeWorkflowExecutionScope: {operation: "HistoryClientDescribeWorkflowExecution"}, + HistoryClientRecordDecisionTaskStartedScope: {operation: "HistoryClientRecordDecisionTaskStarted"}, + HistoryClientRecordActivityTaskStartedScope: {operation: "HistoryClientRecordActivityTaskStarted"}, + HistoryClientRequestCancelWorkflowExecutionScope: {operation: "HistoryClientRequestCancelWorkflowExecution"}, + HistoryClientSignalWorkflowExecutionScope: {operation: "HistoryClientSignalWorkflowExecution"}, + HistoryClientTerminateWorkflowExecutionScope: {operation: "HistoryClientTerminateWorkflowExecution"}, + HistoryClientScheduleDecisionTaskScope: {operation: "HistoryClientScheduleDecisionTask"}, + HistoryClientRecordChildExecutionCompletedScope: {operation: "HistoryClientRecordChildExecutionCompleted"}, + MatchingClientPollForDecisionTaskScope: {operation: "MatchingClientPollForDecisionTask"}, + MatchingClientPollForActivityTaskScope: {operation: "MatchingClientPollForActivityTask"}, + MatchingClientAddActivityTaskScope: {operation: "MatchingClientAddActivityTask"}, + MatchingClientAddDecisionTaskScope: {operation: "MatchingClientAddDecisionTask"}, + MatchingClientQueryWorkflowScope: {operation: "MatchingClientQueryWorkflow"}, + MatchingClientRespondQueryTaskCompletedScope: {operation: "MatchingClientRespondQueryTaskCompleted"}, + MatchingClientCancelOutstandingPollScope: {operation: "MatchingClientCancelOutstandingPoll"}, }, // Frontend Scope Names Frontend: { @@ -439,36 +439,36 @@ var ScopeDefs = map[ServiceIdx]map[int]scopeDefinition{ }, // History Scope Names History: { - HistoryStartWorkflowExecutionScope: {operation: "StartWorkflowExecution"}, - HistoryRecordActivityTaskHeartbeatScope: {operation: "RecordActivityTaskHeartbeat"}, - HistoryRespondDecisionTaskCompletedScope: {operation: "RespondDecisionTaskCompleted"}, - HistoryRespondDecisionTaskFailedScope: {operation: "RespondDecisionTaskFailed"}, - HistoryRespondActivityTaskCompletedScope: {operation: "RespondActivityTaskCompleted"}, - HistoryRespondActivityTaskFailedScope: {operation: "RespondActivityTaskFailed"}, - HistoryRespondActivityTaskCanceledScope: {operation: "RespondActivityTaskCanceled"}, - HistoryGetWorkflowExecutionNextEventIDScope: {operation: "GetWorkflowExecutionNextEventID"}, - HistoryDescribeWorkflowExecutionScope: {operation: "DescribeWorkflowExecution"}, - HistoryRecordDecisionTaskStartedScope: {operation: "RecordDecisionTaskStarted"}, - HistoryRecordActivityTaskStartedScope: {operation: "RecordActivityTaskStarted"}, - HistorySignalWorkflowExecutionScope: {operation: "SignalWorkflowExecution"}, - HistoryTerminateWorkflowExecutionScope: {operation: "TerminateWorkflowExecution"}, - HistoryScheduleDecisionTaskScope: {operation: "ScheduleDecisionTask"}, - HistoryRecordChildExecutionCompletedScope: {operation: "RecordChildExecutionCompleted"}, - HistoryRequestCancelWorkflowExecutionScope: {operation: "RequestCancelWorkflowExecution"}, - HistoryShardControllerScope: {operation: "ShardController"}, - TransferQueueProcessorScope: {operation: "TransferQueueProcessor"}, - TransferTaskActivityScope: {operation: "TransferTaskActivity"}, - TransferTaskDecisionScope: {operation: "TransferTaskDecision"}, - TransferTaskCloseExecutionScope: {operation: "TransferTaskCloseExecution"}, - TransferTaskCancelExecutionScope: {operation: "TransferTaskCancelExecution"}, - TransferTaskStartChildExecutionScope: {operation: "TransferTaskStartChildExecution"}, - TimerQueueProcessorScope: {operation: "TimerQueueProcessor"}, - TimerTaskActivityTimeoutScope: {operation: "TimerTaskActivityTimeout"}, - TimerTaskDecisionTimeoutScope: {operation: "TimerTaskDecisionTimeout"}, - TimerTaskUserTimerScope: {operation: "TimerTaskUserTimer"}, - TimerTaskWorkflowTimeoutScope: {operation: "TimerTaskWorkflowTimeout"}, - TimerTaskDeleteHistoryEvent: {operation: "TimerTaskDeleteHistoryEvent"}, - HistoryEventNotificationScope: {operation: "HistoryEventNotification"}, + HistoryStartWorkflowExecutionScope: {operation: "StartWorkflowExecution"}, + HistoryRecordActivityTaskHeartbeatScope: {operation: "RecordActivityTaskHeartbeat"}, + HistoryRespondDecisionTaskCompletedScope: {operation: "RespondDecisionTaskCompleted"}, + HistoryRespondDecisionTaskFailedScope: {operation: "RespondDecisionTaskFailed"}, + HistoryRespondActivityTaskCompletedScope: {operation: "RespondActivityTaskCompleted"}, + HistoryRespondActivityTaskFailedScope: {operation: "RespondActivityTaskFailed"}, + HistoryRespondActivityTaskCanceledScope: {operation: "RespondActivityTaskCanceled"}, + HistoryGetMutableStateScope: {operation: "GetMutableState"}, + HistoryDescribeWorkflowExecutionScope: {operation: "DescribeWorkflowExecution"}, + HistoryRecordDecisionTaskStartedScope: {operation: "RecordDecisionTaskStarted"}, + HistoryRecordActivityTaskStartedScope: {operation: "RecordActivityTaskStarted"}, + HistorySignalWorkflowExecutionScope: {operation: "SignalWorkflowExecution"}, + HistoryTerminateWorkflowExecutionScope: {operation: "TerminateWorkflowExecution"}, + HistoryScheduleDecisionTaskScope: {operation: "ScheduleDecisionTask"}, + HistoryRecordChildExecutionCompletedScope: {operation: "RecordChildExecutionCompleted"}, + HistoryRequestCancelWorkflowExecutionScope: {operation: "RequestCancelWorkflowExecution"}, + HistoryShardControllerScope: {operation: "ShardController"}, + TransferQueueProcessorScope: {operation: "TransferQueueProcessor"}, + TransferTaskActivityScope: {operation: "TransferTaskActivity"}, + TransferTaskDecisionScope: {operation: "TransferTaskDecision"}, + TransferTaskCloseExecutionScope: {operation: "TransferTaskCloseExecution"}, + TransferTaskCancelExecutionScope: {operation: "TransferTaskCancelExecution"}, + TransferTaskStartChildExecutionScope: {operation: "TransferTaskStartChildExecution"}, + TimerQueueProcessorScope: {operation: "TimerQueueProcessor"}, + TimerTaskActivityTimeoutScope: {operation: "TimerTaskActivityTimeout"}, + TimerTaskDecisionTimeoutScope: {operation: "TimerTaskDecisionTimeout"}, + TimerTaskUserTimerScope: {operation: "TimerTaskUserTimer"}, + TimerTaskWorkflowTimeoutScope: {operation: "TimerTaskWorkflowTimeout"}, + TimerTaskDeleteHistoryEvent: {operation: "TimerTaskDeleteHistoryEvent"}, + HistoryEventNotificationScope: {operation: "HistoryEventNotification"}, }, // Matching Scope Names Matching: { diff --git a/common/mocks/HistoryClient.go b/common/mocks/HistoryClient.go index 13aa6c1abd5..a158892d314 100644 --- a/common/mocks/HistoryClient.go +++ b/common/mocks/HistoryClient.go @@ -31,21 +31,21 @@ type HistoryClient struct { mock.Mock } -// GetWorkflowExecutionNextEventID provides a mock function with given fields: ctx, getRequest -func (_m *HistoryClient) GetWorkflowExecutionNextEventID(ctx context.Context, getRequest *history.GetWorkflowExecutionNextEventIDRequest, opts ...yarpc.CallOption) (*history.GetWorkflowExecutionNextEventIDResponse, error) { +// GetMutableState provides a mock function with given fields: ctx, getRequest +func (_m *HistoryClient) GetMutableState(ctx context.Context, getRequest *history.GetMutableStateRequest, opts ...yarpc.CallOption) (*history.GetMutableStateResponse, error) { ret := _m.Called(ctx, getRequest) - var r0 *history.GetWorkflowExecutionNextEventIDResponse - if rf, ok := ret.Get(0).(func(context.Context, *history.GetWorkflowExecutionNextEventIDRequest) *history.GetWorkflowExecutionNextEventIDResponse); ok { + var r0 *history.GetMutableStateResponse + if rf, ok := ret.Get(0).(func(context.Context, *history.GetMutableStateRequest) *history.GetMutableStateResponse); ok { r0 = rf(ctx, getRequest) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*history.GetWorkflowExecutionNextEventIDResponse) + r0 = ret.Get(0).(*history.GetMutableStateResponse) } } var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *history.GetWorkflowExecutionNextEventIDRequest) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, *history.GetMutableStateRequest) error); ok { r1 = rf(ctx, getRequest) } else { r1 = ret.Error(1) diff --git a/common/persistence/cassandraPersistence.go b/common/persistence/cassandraPersistence.go index 35235f02b7a..ed63d069549 100644 --- a/common/persistence/cassandraPersistence.go +++ b/common/persistence/cassandraPersistence.go @@ -129,7 +129,10 @@ const ( `cancel_requested: ?, ` + `cancel_request_id: ?, ` + `sticky_task_list: ?, ` + - `sticky_schedule_to_start_timeout: ?` + + `sticky_schedule_to_start_timeout: ?,` + + `client_library_version: ?, ` + + `client_feature_version: ?, ` + + `client_impl: ?` + `}` templateTransferTaskType = `{` + @@ -902,6 +905,9 @@ func (d *cassandraPersistence) CreateWorkflowExecutionWithinBatch(request *Creat "", "", // sticky_task_list (no sticky tasklist for new workflow execution) 0, // sticky_schedule_to_start_timeout + "", // client_library_version + "", // client_feature_version + "", // client_impl request.NextEventID, defaultVisibilityTimestamp, rowTypeExecutionTaskID) @@ -1020,6 +1026,9 @@ func (d *cassandraPersistence) UpdateWorkflowExecution(request *UpdateWorkflowEx executionInfo.CancelRequestID, executionInfo.StickyTaskList, executionInfo.StickyScheduleToStartTimeout, + executionInfo.ClientLibraryVersion, + executionInfo.ClientFeatureVersion, + executionInfo.ClientImpl, executionInfo.NextEventID, d.shardID, rowTypeExecution, @@ -2003,6 +2012,12 @@ func createWorkflowExecutionInfo(result map[string]interface{}) *WorkflowExecuti info.StickyTaskList = v.(string) case "sticky_schedule_to_start_timeout": info.StickyScheduleToStartTimeout = int32(v.(int)) + case "client_library_version": + info.ClientLibraryVersion = v.(string) + case "client_feature_version": + info.ClientFeatureVersion = v.(string) + case "client_impl": + info.ClientImpl = v.(string) } } diff --git a/common/persistence/cassandraPersistence_test.go b/common/persistence/cassandraPersistence_test.go index 7a181b023a5..4aa764a8954 100644 --- a/common/persistence/cassandraPersistence_test.go +++ b/common/persistence/cassandraPersistence_test.go @@ -181,6 +181,11 @@ func (s *cassandraPersistenceSuite) TestUpdateWorkflow() { s.Equal(int32(1), info0.DecisionTimeout) s.Equal(int64(0), info0.DecisionAttempt) s.Equal(int64(0), info0.DecisionTimestamp) + s.Empty(info0.StickyTaskList) + s.Equal(int32(0), info0.StickyScheduleToStartTimeout) + s.Empty(info0.ClientLibraryVersion) + s.Empty(info0.ClientFeatureVersion) + s.Empty(info0.ClientImpl) log.Infof("Workflow execution last updated: %v", info0.LastUpdatedTimestamp) @@ -189,6 +194,11 @@ func (s *cassandraPersistenceSuite) TestUpdateWorkflow() { updatedInfo.LastProcessedEvent = int64(2) updatedInfo.DecisionAttempt = int64(123) updatedInfo.DecisionTimestamp = int64(321) + updatedInfo.StickyTaskList = "random sticky tasklist" + updatedInfo.StickyScheduleToStartTimeout = 876 + updatedInfo.ClientLibraryVersion = "random client library version" + updatedInfo.ClientFeatureVersion = "random client feature version" + updatedInfo.ClientImpl = "random client impl" err2 := s.UpdateWorkflowExecution(updatedInfo, []int64{int64(4)}, nil, int64(3), nil, nil, nil, nil, nil, nil) s.Nil(err2, "No error expected.") @@ -213,6 +223,11 @@ func (s *cassandraPersistenceSuite) TestUpdateWorkflow() { s.Equal(int32(1), info1.DecisionTimeout) s.Equal(int64(123), info1.DecisionAttempt) s.Equal(int64(321), info1.DecisionTimestamp) + s.Equal(updatedInfo.StickyTaskList, info1.StickyTaskList) + s.Equal(updatedInfo.StickyScheduleToStartTimeout, info1.StickyScheduleToStartTimeout) + s.Equal(updatedInfo.ClientLibraryVersion, info1.ClientLibraryVersion) + s.Equal(updatedInfo.ClientFeatureVersion, info1.ClientFeatureVersion) + s.Equal(updatedInfo.ClientImpl, info1.ClientImpl) log.Infof("Workflow execution last updated: %v", info1.LastUpdatedTimestamp) diff --git a/common/persistence/dataInterfaces.go b/common/persistence/dataInterfaces.go index 794a370c0be..be075b8bfc7 100644 --- a/common/persistence/dataInterfaces.go +++ b/common/persistence/dataInterfaces.go @@ -144,7 +144,7 @@ type ( StickyScheduleToStartTimeout int32 ClientLibraryVersion string ClientFeatureVersion string - ClientLang string + ClientImpl string } // TransferTaskInfo describes a transfer task diff --git a/common/rpc.go b/common/rpc.go index 0f4d9ffb035..20a1440f281 100644 --- a/common/rpc.go +++ b/common/rpc.go @@ -35,10 +35,9 @@ const ( // feature version FeatureVersionHeaderName = "cadence-client-feature-version" - // LanguageHeaderName refers to the name of the - // tchannel / http header that contains the client - // language - LanguageHeaderName = "cadence-client-language" + // ClientImplHeaderName refers to the name of the + // header that contains the client implementation + ClientImplHeaderName = "cadence-client-name" ) type ( diff --git a/host/integration_test.go b/host/integration_test.go index 42570f600f6..ee4ce1c8554 100644 --- a/host/integration_test.go +++ b/host/integration_test.go @@ -627,8 +627,8 @@ Loop: }, }, yarpc.WithHeader(common.LibraryVersionHeaderName, "0.0.1"), - yarpc.WithHeader(common.FeatureVersionHeaderName, "1"), - yarpc.WithHeader(common.LanguageHeaderName, "go"), + yarpc.WithHeader(common.FeatureVersionHeaderName, "1.0.0"), + yarpc.WithHeader(common.ClientImplHeaderName, "go"), ) } @@ -1882,125 +1882,7 @@ func (s *integrationSuite) TestQueryWorkflow_NonSticky() { s.Equal("unknown-query-type", queryFailError.Message) } -func (s *integrationSuite) TestDescribeWorkflowExecution_Sticky() { - id := "interation-describe-wfe-test" - wt := "interation-describe-wfe-test-type" - tl := "interation-describe-wfe-test-tasklist" - stl := "interation-query-workflow-test-tasklist-sticky" - identity := "worker1" - - workflowType := &workflow.WorkflowType{} - workflowType.Name = common.StringPtr(wt) - - taskList := &workflow.TaskList{} - taskList.Name = common.StringPtr(tl) - - stickyTaskList := &workflow.TaskList{} - stickyTaskList.Name = common.StringPtr(stl) - stickyScheduleToStartTimeoutSeconds := common.Int32Ptr(10) - - execution := workflow.WorkflowExecution{ - WorkflowId: common.StringPtr(id), - } - - // Start workflow execution - request := &workflow.StartWorkflowExecutionRequest{ - RequestId: common.StringPtr(uuid.New()), - Domain: common.StringPtr(s.domainName), - WorkflowId: common.StringPtr(id), - WorkflowType: workflowType, - TaskList: taskList, - Input: nil, - ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(100), - TaskStartToCloseTimeoutSeconds: common.Int32Ptr(1), - Identity: common.StringPtr(identity), - } - - resp, err0 := s.engine.StartWorkflowExecution(createContext(), request) - execution.RunId = resp.RunId - s.Nil(err0) - - s.logger.Infof("StartWorkflowExecution: response: %v \n", *resp.RunId) - - describeWorkflowExecution := func() (*workflow.DescribeWorkflowExecutionResponse, error) { - return s.engine.DescribeWorkflowExecution(createContext(), &workflow.DescribeWorkflowExecutionRequest{ - Domain: common.StringPtr(s.domainName), - Execution: &execution, - }) - } - dweResponse, err := describeWorkflowExecution() - s.Nil(err) - s.True(nil == dweResponse.WorkflowExecutionInfo.CloseTime) - s.Equal(int64(2), *dweResponse.WorkflowExecutionInfo.HistoryLength) // WorkflowStarted, DecisionScheduled - - // decider logic - workflowComplete := false - signalSent := false - var signalEvent *workflow.HistoryEvent - dtHandler := func(execution *workflow.WorkflowExecution, wt *workflow.WorkflowType, - previousStartedEventID, startedEventID int64, history *workflow.History) ([]byte, []*workflow.Decision, error) { - if !signalSent { - signalSent = true - - s.NoError(err) - return nil, []*workflow.Decision{{ - DecisionType: common.DecisionTypePtr(workflow.DecisionTypeScheduleActivityTask), - ScheduleActivityTaskDecisionAttributes: &workflow.ScheduleActivityTaskDecisionAttributes{ - ActivityId: common.StringPtr("1"), - ActivityType: &workflow.ActivityType{Name: common.StringPtr("test-activity-type")}, - TaskList: &workflow.TaskList{Name: &tl}, - Input: []byte("test-input"), - ScheduleToCloseTimeoutSeconds: common.Int32Ptr(100), - ScheduleToStartTimeoutSeconds: common.Int32Ptr(2), - StartToCloseTimeoutSeconds: common.Int32Ptr(50), - HeartbeatTimeoutSeconds: common.Int32Ptr(5), - }, - }}, nil - } else if previousStartedEventID > 0 && signalEvent == nil { - for _, event := range history.Events[previousStartedEventID:] { - if *event.EventType == workflow.EventTypeWorkflowExecutionSignaled { - signalEvent = event - } - } - } - - workflowComplete = true - return nil, []*workflow.Decision{{ - DecisionType: common.DecisionTypePtr(workflow.DecisionTypeCompleteWorkflowExecution), - CompleteWorkflowExecutionDecisionAttributes: &workflow.CompleteWorkflowExecutionDecisionAttributes{ - Result: []byte("Done."), - }, - }}, nil - } - - poller := &taskPoller{ - engine: s.engine, - domain: s.domainName, - taskList: taskList, - identity: identity, - decisionHandler: dtHandler, - activityHandler: nil, - logger: s.logger, - suite: s, - sticktTaskList: stickyTaskList, - stickyScheduleToStartTimeoutSeconds: stickyScheduleToStartTimeoutSeconds, - } - - // first decision to schedule new activity, tell server can use sticky tasklist - _, err = poller.pollAndProcessDecisionTaskWithAttempt(false, false, false, true, int64(0)) - s.logger.Infof("pollAndProcessDecisionTask: %v", err) - s.Nil(err) - - dweResponse, err = describeWorkflowExecution() - s.Nil(err) - s.True(nil == dweResponse.WorkflowExecutionInfo.CloseStatus) - s.Equal(int64(5), *dweResponse.WorkflowExecutionInfo.HistoryLength) // DecisionStarted, DecisionCompleted, ActivityScheduled - s.Equal(tl, dweResponse.ExecutionConfiguration.TaskList.GetName()) - s.Equal(stl, dweResponse.ExecutionConfiguration.StickyTaskList.GetName()) - s.Equal(*stickyScheduleToStartTimeoutSeconds, *dweResponse.ExecutionConfiguration.StickyScheduleToStartTimeoutSeconds) -} - -func (s *integrationSuite) TestDescribeWorkflowExecution_NonSticky() { +func (s *integrationSuite) TestDescribeWorkflowExecution() { id := "interation-describe-wfe-test" wt := "interation-describe-wfe-test-type" tl := "interation-describe-wfe-test-tasklist" diff --git a/idl/github.com/uber/cadence/history.thrift b/idl/github.com/uber/cadence/history.thrift index e678ffb7dfc..3aa0202b66b 100644 --- a/idl/github.com/uber/cadence/history.thrift +++ b/idl/github.com/uber/cadence/history.thrift @@ -43,17 +43,23 @@ struct StartWorkflowExecutionRequest { 30: optional ParentExecutionInfo parentExecutionInfo } -struct GetWorkflowExecutionNextEventIDRequest { +struct GetMutableStateRequest { 10: optional string domainUUID 20: optional shared.WorkflowExecution execution 30: optional i64 (js.type = "Long") expectedNextEventId } -struct GetWorkflowExecutionNextEventIDResponse { - 10: optional i64 (js.type = "Long") eventId - 20: optional string runId - 30: optional shared.TaskList tasklist - 40: optional bool isWorkflowRunning +struct GetMutableStateResponse { + 10: optional shared.WorkflowExecution execution + 20: optional shared.WorkflowType workflowType + 30: optional i64 (js.type = "Long") NextEventId + 40: optional i64 (js.type = "Long") LastFirstEventId + 50: optional shared.TaskList taskList + 60: optional shared.TaskList stickyTaskList + 70: optional string clientLibraryVersion + 80: optional string clientFeatureVersion + 90: optional string clientImpl + 100: optional bool isWorkflowRunning } struct RespondDecisionTaskCompletedRequest { @@ -182,11 +188,10 @@ service HistoryService { ) /** - * Returns the nextEventID of the history of workflow execution. Only events in the history with Ids below the returned Id are - * guaranteed to be valid, so the first step of reading an execution's history is to retrieve this event Id. + * Returns the information from mutable state of workflow execution. * It fails with 'EntityNotExistError' if specified workflow execution in unknown to the service. **/ - GetWorkflowExecutionNextEventIDResponse GetWorkflowExecutionNextEventID(1: GetWorkflowExecutionNextEventIDRequest getRequest) + GetMutableStateResponse GetMutableState(1: GetMutableStateRequest getRequest) throws ( 1: shared.BadRequestError badRequestError, 2: shared.InternalServiceError internalServiceError, diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index cef958cc234..1ad16428455 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -202,11 +202,6 @@ struct WorkflowExecutionConfiguration { 20: optional i32 executionStartToCloseTimeoutSeconds 30: optional i32 taskStartToCloseTimeoutSeconds 40: optional ChildPolicy childPolicy - 50: optional TaskList stickyTaskList - 60: optional i32 stickyScheduleToStartTimeoutSeconds - 70: optional string clientLibraryVersion - 80: optional string clientFeatureVersion - 90: optional string clientLang } struct TransientDecisionInfo { diff --git a/schema/cadence/schema.cql b/schema/cadence/schema.cql index 3d62c766b6c..af9a9d555e8 100644 --- a/schema/cadence/schema.cql +++ b/schema/cadence/schema.cql @@ -43,6 +43,9 @@ CREATE TYPE workflow_execution ( cancel_request_id text, sticky_task_list text, -- sticky worker task list sticky_schedule_to_start_timeout int, + client_library_version text, + client_feature_version text, + client_impl text, ); -- TODO: Remove fields that are left over from activity and workflow tasks. diff --git a/schema/cadence/versioned/v0.3/add_client_version.cql b/schema/cadence/versioned/v0.3/add_client_version.cql new file mode 100644 index 00000000000..3a71fb247d6 --- /dev/null +++ b/schema/cadence/versioned/v0.3/add_client_version.cql @@ -0,0 +1,3 @@ +ALTER TYPE workflow_execution ADD client_library_version text; +ALTER TYPE workflow_execution ADD client_feature_version text; +ALTER TYPE workflow_execution ADD client_impl text; diff --git a/schema/cadence/versioned/v0.3/manifest.json b/schema/cadence/versioned/v0.3/manifest.json new file mode 100644 index 00000000000..c4c8aa670ff --- /dev/null +++ b/schema/cadence/versioned/v0.3/manifest.json @@ -0,0 +1,8 @@ +{ + "CurrVersion": "0.3", + "MinCompatibleVersion": "0.3", + "Description": "add client_library_version, client_feature_version and client_impl to mutable state", + "SchemaUpdateCqlFiles": [ + "add_client_version.cql" + ] +} diff --git a/service/frontend/handler.go b/service/frontend/handler.go index 8564bdb51e4..e7a8223780d 100644 --- a/service/frontend/handler.go +++ b/service/frontend/handler.go @@ -43,7 +43,6 @@ import ( "github.com/uber/cadence/common/metrics" "github.com/uber/cadence/common/persistence" "github.com/uber/cadence/common/service" - "go.uber.org/yarpc" ) var _ workflowserviceserver.Interface = (*WorkflowHandler)(nil) @@ -745,19 +744,9 @@ func (wh *WorkflowHandler) RespondDecisionTaskCompleted( return wh.error(errDomainNotSet, scope) } - var headers []yarpc.CallOption - call := yarpc.CallFromContext(ctx) - for _, key := range call.HeaderNames() { - value := call.Header(key) - headers = append(headers, yarpc.WithHeader(key, value)) - } - err = wh.history.RespondDecisionTaskCompleted( - ctx, - &h.RespondDecisionTaskCompletedRequest{ - DomainUUID: common.StringPtr(taskToken.DomainID), - CompleteRequest: completeRequest, - }, - headers..., + err = wh.history.RespondDecisionTaskCompleted(ctx, &h.RespondDecisionTaskCompletedRequest{ + DomainUUID: common.StringPtr(taskToken.DomainID), + CompleteRequest: completeRequest}, ) if err != nil { return wh.error(err, scope) @@ -935,14 +924,14 @@ func (wh *WorkflowHandler) GetWorkflowExecutionHistory( // 2. the next event ID // 3. whether the workflow is closed getNextEventID := func(domainUUID string, execution *gen.WorkflowExecution, expectedNextEventID *int64) (string, int64, bool, error) { - response, err := wh.history.GetWorkflowExecutionNextEventID(ctx, &h.GetWorkflowExecutionNextEventIDRequest{ + response, err := wh.history.GetMutableState(ctx, &h.GetMutableStateRequest{ DomainUUID: common.StringPtr(domainUUID), Execution: execution, ExpectedNextEventId: expectedNextEventID, }) if err == nil { - return response.GetRunId(), response.GetEventId(), response.GetIsWorkflowRunning(), nil + return response.Execution.GetRunId(), response.GetNextEventId(), response.GetIsWorkflowRunning(), nil } if _, ok := err.(*gen.EntityNotExistsError); !ok || execution.RunId == nil { @@ -1362,32 +1351,27 @@ func (wh *WorkflowHandler) QueryWorkflow(ctx context.Context, } // we should always use the mutable state, since it contains the sticky tasklist information - response, err := wh.history.DescribeWorkflowExecution( - ctx, - &h.DescribeWorkflowExecutionRequest{ - DomainUUID: common.StringPtr(domainInfo.ID), - Request: &gen.DescribeWorkflowExecutionRequest{ - Domain: queryRequest.Domain, - Execution: queryRequest.Execution, - }, - }) + response, err := wh.history.GetMutableState(ctx, &h.GetMutableStateRequest{ + DomainUUID: common.StringPtr(domainInfo.ID), + Execution: queryRequest.Execution, + }) if err != nil { return nil, wh.error(err, scope) } clientFeature := client.NewFeatureImpl( - *response.ExecutionConfiguration.ClientLibraryVersion, - *response.ExecutionConfiguration.ClientFeatureVersion, - *response.ExecutionConfiguration.ClientLang, + response.GetClientLibraryVersion(), + response.GetClientFeatureVersion(), + response.GetClientImpl(), ) - queryRequest.Execution.RunId = response.WorkflowExecutionInfo.Execution.RunId - if response.ExecutionConfiguration.StickyTaskList == nil || len(response.ExecutionConfiguration.StickyTaskList.GetName()) == 0 { - matchingRequest.TaskList = response.ExecutionConfiguration.TaskList + queryRequest.Execution.RunId = response.Execution.RunId + if len(response.StickyTaskList.GetName()) == 0 { + matchingRequest.TaskList = response.TaskList } else if !clientFeature.SupportStickyQuery() { // sticky enabled on the client side, but client chose to use non sticky, which is also the default - matchingRequest.TaskList = response.ExecutionConfiguration.TaskList + matchingRequest.TaskList = response.TaskList } else { - matchingRequest.TaskList = response.ExecutionConfiguration.StickyTaskList + matchingRequest.TaskList = response.StickyTaskList } matchingResp, err := wh.matching.QueryWorkflow(ctx, matchingRequest) @@ -1642,7 +1626,7 @@ func (wh *WorkflowHandler) createPollForDecisionTaskResponse(ctx context.Context if len(persistenceToken) != 0 { continuation, err = serializeHistoryToken(&getHistoryContinuationToken{ - RunID: *matchingResp.WorkflowExecution.RunId, + RunID: matchingResp.WorkflowExecution.GetRunId(), FirstEventID: firstEventID, NextEventID: nextEventID, PersistenceToken: persistenceToken, diff --git a/service/history/MockHistoryEngine.go b/service/history/MockHistoryEngine.go index bb49c3094fa..825d7a59c55 100644 --- a/service/history/MockHistoryEngine.go +++ b/service/history/MockHistoryEngine.go @@ -66,21 +66,21 @@ func (_m *MockHistoryEngine) StartWorkflowExecution(request *gohistory.StartWork return r0, r1 } -// GetWorkflowExecutionNextEventID is mock implementation for GetWorkflowExecutionNextEventID of HistoryEngine -func (_m *MockHistoryEngine) GetWorkflowExecutionNextEventID(ctx context.Context, request *gohistory.GetWorkflowExecutionNextEventIDRequest) (*gohistory.GetWorkflowExecutionNextEventIDResponse, error) { +// GetMutableState is mock implementation for GetMutableState of HistoryEngine +func (_m *MockHistoryEngine) GetMutableState(ctx context.Context, request *gohistory.GetMutableStateRequest) (*gohistory.GetMutableStateResponse, error) { ret := _m.Called(ctx, request) - var r0 *gohistory.GetWorkflowExecutionNextEventIDResponse - if rf, ok := ret.Get(0).(func(*gohistory.GetWorkflowExecutionNextEventIDRequest) *gohistory.GetWorkflowExecutionNextEventIDResponse); ok { + var r0 *gohistory.GetMutableStateResponse + if rf, ok := ret.Get(0).(func(*gohistory.GetMutableStateRequest) *gohistory.GetMutableStateResponse); ok { r0 = rf(request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*gohistory.GetWorkflowExecutionNextEventIDResponse) + r0 = ret.Get(0).(*gohistory.GetMutableStateResponse) } } var r1 error - if rf, ok := ret.Get(1).(func(*gohistory.GetWorkflowExecutionNextEventIDRequest) error); ok { + if rf, ok := ret.Get(1).(func(*gohistory.GetMutableStateRequest) error); ok { r1 = rf(request) } else { r1 = ret.Error(1) diff --git a/service/history/handler.go b/service/history/handler.go index ed07082e4ee..1fc903f9917 100644 --- a/service/history/handler.go +++ b/service/history/handler.go @@ -477,13 +477,13 @@ func (h *Handler) StartWorkflowExecution(ctx context.Context, return response, nil } -// GetWorkflowExecutionNextEventID - returns the id of the next event in the execution's history -func (h *Handler) GetWorkflowExecutionNextEventID(ctx context.Context, - getRequest *hist.GetWorkflowExecutionNextEventIDRequest) (*hist.GetWorkflowExecutionNextEventIDResponse, error) { +// GetMutableState - returns the id of the next event in the execution's history +func (h *Handler) GetMutableState(ctx context.Context, + getRequest *hist.GetMutableStateRequest) (*hist.GetMutableStateResponse, error) { h.startWG.Wait() - h.metricsClient.IncCounter(metrics.HistoryGetWorkflowExecutionNextEventIDScope, metrics.CadenceRequests) - sw := h.metricsClient.StartTimer(metrics.HistoryGetWorkflowExecutionNextEventIDScope, metrics.CadenceLatency) + h.metricsClient.IncCounter(metrics.HistoryGetMutableStateScope, metrics.CadenceRequests) + sw := h.metricsClient.StartTimer(metrics.HistoryGetMutableStateScope, metrics.CadenceLatency) defer sw.Stop() if getRequest.DomainUUID == nil { @@ -493,13 +493,13 @@ func (h *Handler) GetWorkflowExecutionNextEventID(ctx context.Context, workflowExecution := getRequest.Execution engine, err1 := h.controller.GetEngine(*workflowExecution.WorkflowId) if err1 != nil { - h.updateErrorMetric(metrics.HistoryGetWorkflowExecutionNextEventIDScope, err1) + h.updateErrorMetric(metrics.HistoryGetMutableStateScope, err1) return nil, err1 } - resp, err2 := engine.GetWorkflowExecutionNextEventID(ctx, getRequest) + resp, err2 := engine.GetMutableState(ctx, getRequest) if err2 != nil { - h.updateErrorMetric(metrics.HistoryGetWorkflowExecutionNextEventIDScope, h.convertError(err2)) + h.updateErrorMetric(metrics.HistoryGetMutableStateScope, h.convertError(err2)) return nil, h.convertError(err2) } return resp, nil diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index a5cb1877b4d..c831ebdadd1 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -290,9 +290,9 @@ func (e *historyEngineImpl) StartWorkflowExecution(startRequest *h.StartWorkflow }, nil } -// GetWorkflowExecutionNextEventID retrieves the nextEventId of the workflow execution history -func (e *historyEngineImpl) GetWorkflowExecutionNextEventID(ctx context.Context, - request *h.GetWorkflowExecutionNextEventIDRequest) (*h.GetWorkflowExecutionNextEventIDResponse, error) { +// GetMutableState retrieves the mutable state of the workflow execution +func (e *historyEngineImpl) GetMutableState(ctx context.Context, + request *h.GetMutableStateRequest) (*h.GetMutableStateResponse, error) { domainID, err := getDomainUUID(request.DomainUUID) if err != nil { @@ -304,7 +304,7 @@ func (e *historyEngineImpl) GetWorkflowExecutionNextEventID(ctx context.Context, RunId: request.Execution.RunId, } - response, err := e.getWorkflowExecutionNextEventID(domainID, execution) + response, err := e.getMutableState(domainID, execution) if err != nil { return nil, err } @@ -317,7 +317,7 @@ func (e *historyEngineImpl) GetWorkflowExecutionNextEventID(ctx context.Context, // if caller decide to long poll on workflow execution // and the event ID we are looking for is smaller than current next event ID - if expectedNextEventID >= response.GetEventId() && response.GetIsWorkflowRunning() { + if expectedNextEventID >= response.GetNextEventId() && response.GetIsWorkflowRunning() { subscriberID, channel, err := e.historyEventNotifier.WatchHistoryEvent(newWorkflowIdentifier(domainID, &execution)) if err != nil { return nil, err @@ -325,12 +325,12 @@ func (e *historyEngineImpl) GetWorkflowExecutionNextEventID(ctx context.Context, defer e.historyEventNotifier.UnwatchHistoryEvent(newWorkflowIdentifier(domainID, &execution), subscriberID) // check again in case the next event ID is updated - response, err = e.getWorkflowExecutionNextEventID(domainID, execution) + response, err = e.getMutableState(domainID, execution) if err != nil { return nil, err } - if expectedNextEventID < response.GetEventId() || !response.GetIsWorkflowRunning() { + if expectedNextEventID < response.GetNextEventId() || !response.GetIsWorkflowRunning() { return response, nil } @@ -339,9 +339,9 @@ func (e *historyEngineImpl) GetWorkflowExecutionNextEventID(ctx context.Context, for { select { case event := <-channel: - response.EventId = common.Int64Ptr(event.nextEventID) + response.NextEventId = common.Int64Ptr(event.nextEventID) response.IsWorkflowRunning = common.BoolPtr(event.isWorkflowRunning) - if expectedNextEventID < response.GetEventId() || !response.GetIsWorkflowRunning() { + if expectedNextEventID < response.GetNextEventId() || !response.GetIsWorkflowRunning() { return response, nil } case <-timer.C: @@ -355,8 +355,8 @@ func (e *historyEngineImpl) GetWorkflowExecutionNextEventID(ctx context.Context, return response, nil } -func (e *historyEngineImpl) getWorkflowExecutionNextEventID( - domainID string, execution workflow.WorkflowExecution) (*h.GetWorkflowExecutionNextEventIDResponse, error) { +func (e *historyEngineImpl) getMutableState( + domainID string, execution workflow.WorkflowExecution) (*h.GetMutableStateResponse, error) { context, release, err0 := e.historyCache.getOrCreateWorkflowExecution(domainID, execution) if err0 != nil { @@ -369,11 +369,19 @@ func (e *historyEngineImpl) getWorkflowExecutionNextEventID( return nil, err1 } - result := &h.GetWorkflowExecutionNextEventIDResponse{} - result.EventId = common.Int64Ptr(msBuilder.GetNextEventID()) - result.RunId = context.workflowExecution.RunId - result.Tasklist = &workflow.TaskList{Name: common.StringPtr(context.msBuilder.executionInfo.TaskList)} - result.IsWorkflowRunning = common.BoolPtr(msBuilder.isWorkflowExecutionRunning()) + execution.RunId = context.workflowExecution.RunId + result := &h.GetMutableStateResponse{ + Execution: &execution, + WorkflowType: &workflow.WorkflowType{Name: common.StringPtr(msBuilder.executionInfo.WorkflowTypeName)}, + NextEventId: common.Int64Ptr(msBuilder.GetNextEventID()), + TaskList: &workflow.TaskList{Name: common.StringPtr(context.msBuilder.executionInfo.TaskList)}, + StickyTaskList: &workflow.TaskList{Name: common.StringPtr(msBuilder.executionInfo.StickyTaskList)}, + ClientLibraryVersion: common.StringPtr(msBuilder.executionInfo.ClientLibraryVersion), + ClientFeatureVersion: common.StringPtr(msBuilder.executionInfo.ClientFeatureVersion), + ClientImpl: common.StringPtr(msBuilder.executionInfo.ClientImpl), + IsWorkflowRunning: common.BoolPtr(msBuilder.isWorkflowExecutionRunning()), + } + return result, nil } @@ -404,11 +412,6 @@ func (e *historyEngineImpl) DescribeWorkflowExecution( ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(msBuilder.executionInfo.WorkflowTimeout), TaskStartToCloseTimeoutSeconds: common.Int32Ptr(msBuilder.executionInfo.DecisionTimeoutValue), ChildPolicy: common.ChildPolicyPtr(workflow.ChildPolicyTerminate), - StickyTaskList: &workflow.TaskList{Name: common.StringPtr(msBuilder.executionInfo.StickyTaskList)}, - StickyScheduleToStartTimeoutSeconds: common.Int32Ptr(msBuilder.executionInfo.StickyScheduleToStartTimeout), - ClientLibraryVersion: common.StringPtr(msBuilder.executionInfo.ClientLibraryVersion), - ClientFeatureVersion: common.StringPtr(msBuilder.executionInfo.ClientFeatureVersion), - ClientLang: common.StringPtr(msBuilder.executionInfo.ClientLang), }, WorkflowExecutionInfo: &workflow.WorkflowExecutionInfo{ Execution: request.Request.Execution, @@ -651,7 +654,7 @@ func (e *historyEngineImpl) RespondDecisionTaskCompleted(ctx context.Context, re call := yarpc.CallFromContext(ctx) clientLibVersion := call.Header(common.LibraryVersionHeaderName) clientFeatureVersion := call.Header(common.FeatureVersionHeaderName) - clientLang := call.Header(common.LanguageHeaderName) + clientImpl := call.Header(common.ClientImplHeaderName) context, release, err0 := e.historyCache.getOrCreateWorkflowExecution(domainID, workflowExecution) if err0 != nil { @@ -712,7 +715,7 @@ Update_History_Loop: } msBuilder.executionInfo.ClientLibraryVersion = clientLibVersion msBuilder.executionInfo.ClientFeatureVersion = clientFeatureVersion - msBuilder.executionInfo.ClientLang = clientLang + msBuilder.executionInfo.ClientImpl = clientImpl Process_Decision_Loop: for _, d := range request.Decisions { diff --git a/service/history/historyEngineInterfaces.go b/service/history/historyEngineInterfaces.go index b7a85e6bb34..4edcb7e2961 100644 --- a/service/history/historyEngineInterfaces.go +++ b/service/history/historyEngineInterfaces.go @@ -49,7 +49,7 @@ type ( // TODO: Convert workflow.WorkflowExecution to pointer all over the place StartWorkflowExecution(request *h.StartWorkflowExecutionRequest) (*workflow.StartWorkflowExecutionResponse, error) - GetWorkflowExecutionNextEventID(ctx context.Context, request *h.GetWorkflowExecutionNextEventIDRequest) (*h.GetWorkflowExecutionNextEventIDResponse, error) + GetMutableState(ctx context.Context, request *h.GetMutableStateRequest) (*h.GetMutableStateResponse, error) DescribeWorkflowExecution( request *h.DescribeWorkflowExecutionRequest) (*workflow.DescribeWorkflowExecutionResponse, error) RecordDecisionTaskStarted(request *h.RecordDecisionTaskStartedRequest) (*h.RecordDecisionTaskStartedResponse, error) diff --git a/service/history/historyEngine_test.go b/service/history/historyEngine_test.go index 102a96da5f8..31111297762 100644 --- a/service/history/historyEngine_test.go +++ b/service/history/historyEngine_test.go @@ -153,7 +153,7 @@ func (s *engineSuite) TearDownTest() { s.mockVisibilityMgr.AssertExpectations(s.T()) } -func (s *engineSuite) TestGetWorkflowExecutionNextEventIDSync() { +func (s *engineSuite) TestGetMutableStateSync() { ctx := context.Background() domainID := "domainId" execution := workflow.WorkflowExecution{ @@ -173,15 +173,15 @@ func (s *engineSuite) TestGetWorkflowExecutionNextEventIDSync() { s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gweResponse, nil).Once() // test get the next event ID instantly - response, err := s.mockHistoryEngine.GetWorkflowExecutionNextEventID(ctx, &history.GetWorkflowExecutionNextEventIDRequest{ + response, err := s.mockHistoryEngine.GetMutableState(ctx, &history.GetMutableStateRequest{ DomainUUID: common.StringPtr(domainID), Execution: &execution, }) s.Nil(err) - s.Equal(int64(4), *response.EventId) + s.Equal(int64(4), *response.NextEventId) } -func (s *engineSuite) TestGetWorkflowExecutionNextEventIDLongPoll() { +func (s *engineSuite) TestGetMutableStateLongPoll() { ctx := context.Background() domainID := "domainId" execution := workflow.WorkflowExecution{ @@ -224,28 +224,28 @@ func (s *engineSuite) TestGetWorkflowExecutionNextEventIDLongPoll() { } // return immediately, since the expected next event ID appears - response, err := s.mockHistoryEngine.GetWorkflowExecutionNextEventID(ctx, &history.GetWorkflowExecutionNextEventIDRequest{ + response, err := s.mockHistoryEngine.GetMutableState(ctx, &history.GetMutableStateRequest{ DomainUUID: common.StringPtr(domainID), Execution: &execution, ExpectedNextEventId: common.Int64Ptr(4), }) s.Nil(err) - s.Equal(int64(4), *response.EventId) + s.Equal(int64(4), *response.NextEventId) // long poll, new event happen before long poll timeout go asycWorkflowUpdate(time.Second * 10) start := time.Now() - response, err = s.mockHistoryEngine.GetWorkflowExecutionNextEventID(ctx, &history.GetWorkflowExecutionNextEventIDRequest{ + response, err = s.mockHistoryEngine.GetMutableState(ctx, &history.GetMutableStateRequest{ DomainUUID: common.StringPtr(domainID), Execution: &execution, ExpectedNextEventId: common.Int64Ptr(5), }) s.True(time.Now().After(start.Add(time.Second * 5))) s.Nil(err) - s.Equal(int64(5), *response.EventId) + s.Equal(int64(5), *response.NextEventId) } -func (s *engineSuite) TestGetWorkflowExecutionNextEventIDLongPollTimeout() { +func (s *engineSuite) TestGetMutableStateLongPollTimeout() { ctx := context.Background() domainID := "domainId" execution := workflow.WorkflowExecution{ @@ -265,13 +265,13 @@ func (s *engineSuite) TestGetWorkflowExecutionNextEventIDLongPollTimeout() { s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gweResponse, nil).Once() // long poll, no event happen after long poll timeout - response, err := s.mockHistoryEngine.GetWorkflowExecutionNextEventID(ctx, &history.GetWorkflowExecutionNextEventIDRequest{ + response, err := s.mockHistoryEngine.GetMutableState(ctx, &history.GetMutableStateRequest{ DomainUUID: common.StringPtr(domainID), Execution: &execution, ExpectedNextEventId: common.Int64Ptr(5), }) s.Nil(err) - s.Equal(int64(4), *response.EventId) + s.Equal(int64(4), *response.NextEventId) } func (s *engineSuite) TestRespondDecisionTaskCompletedInvalidToken() { diff --git a/service/history/mutableStateBuilder.go b/service/history/mutableStateBuilder.go index e3c848d851f..b1d9b472dba 100644 --- a/service/history/mutableStateBuilder.go +++ b/service/history/mutableStateBuilder.go @@ -682,7 +682,7 @@ func (e *mutableStateBuilder) clearStickyness() { e.executionInfo.StickyScheduleToStartTimeout = 0 e.executionInfo.ClientLibraryVersion = "" e.executionInfo.ClientFeatureVersion = "" - e.executionInfo.ClientLang = "" + e.executionInfo.ClientImpl = "" } // GetNextEventID returns next event ID diff --git a/service/history/service.go b/service/history/service.go index 8552b95edaf..d159954d8cb 100644 --- a/service/history/service.go +++ b/service/history/service.go @@ -68,7 +68,7 @@ type Config struct { HistoryMgrNumConns int // Time to hold a poll request before returning an empty response - // right now only used by GetWorkflowExecutionNextEventID + // right now only used by GetMutableState LongPollExpirationInterval time.Duration } diff --git a/service/matching/matchingEngine.go b/service/matching/matchingEngine.go index 5d51afb4d2e..34180cacaa7 100644 --- a/service/matching/matchingEngine.go +++ b/service/matching/matchingEngine.go @@ -258,12 +258,9 @@ pollLoop: if tCtx.queryTaskInfo != nil { // for query task, we don't need to update history to record decision task started. but we need to know // the NextEventID so front end knows what are the history events to load for this decision task. - describeResp, err := e.historyService.DescribeWorkflowExecution(ctx, &h.DescribeWorkflowExecutionRequest{ + mutableStateResp, err := e.historyService.GetMutableState(ctx, &h.GetMutableStateRequest{ DomainUUID: req.DomainUUID, - Request: &workflow.DescribeWorkflowExecutionRequest{ - Domain: req.PollRequest.Domain, - Execution: &tCtx.workflowExecution, - }, + Execution: &tCtx.workflowExecution, }) if err != nil { // will notify query client that the query task failed @@ -279,13 +276,13 @@ pollLoop: } isStickyEnabled := false - if describeResp.ExecutionConfiguration.StickyTaskList != nil && len(describeResp.ExecutionConfiguration.StickyTaskList.GetName()) != 0 { + if len(mutableStateResp.StickyTaskList.GetName()) != 0 { isStickyEnabled = true } resp := &h.RecordDecisionTaskStartedResponse{ - PreviousStartedEventId: describeResp.WorkflowExecutionInfo.HistoryLength, - NextEventId: describeResp.WorkflowExecutionInfo.HistoryLength, - WorkflowType: describeResp.WorkflowExecutionInfo.Type, + PreviousStartedEventId: mutableStateResp.NextEventId, + NextEventId: mutableStateResp.NextEventId, + WorkflowType: mutableStateResp.WorkflowType, StickyExecutionEnabled: common.BoolPtr(isStickyEnabled), } tCtx.completeTask(nil) diff --git a/tools/cassandra/updateTask_test.go b/tools/cassandra/updateTask_test.go index 4271f55d5c6..f6a543380da 100644 --- a/tools/cassandra/updateTask_test.go +++ b/tools/cassandra/updateTask_test.go @@ -130,7 +130,7 @@ func (s *UpdateSchemaTestSuite) TestDryrun() { s.Nil(err) // update the version to the latest s.log.Infof("Ver: %v", ver) - s.Equal(0, cmpVersion(ver, "0.2")) + s.Equal(0, cmpVersion(ver, "0.3")) dropAllTablesTypes(client) } From cdf0a36fc40916d8e2a4727e766f3d05a9ccf840 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Fri, 15 Dec 2017 15:49:06 -0800 Subject: [PATCH 5/5] address comments --- client/history/client.go | 45 ++++++++++++++------------------------- client/matching/client.go | 27 ++++++----------------- common/rpc.go | 19 +++++++++++++++++ 3 files changed, 42 insertions(+), 49 deletions(-) diff --git a/client/history/client.go b/client/history/client.go index 3eda2167904..19f98721c6b 100644 --- a/client/history/client.go +++ b/client/history/client.go @@ -70,7 +70,7 @@ func (c *clientImpl) StartWorkflowExecution( if err != nil { return nil, err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) var response *workflow.StartWorkflowExecutionResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -94,7 +94,7 @@ func (c *clientImpl) GetMutableState( if err != nil { return nil, err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) var response *h.GetMutableStateResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -118,7 +118,7 @@ func (c *clientImpl) DescribeWorkflowExecution( if err != nil { return nil, err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) var response *workflow.DescribeWorkflowExecutionResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -142,7 +142,7 @@ func (c *clientImpl) RecordDecisionTaskStarted( if err != nil { return nil, err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) var response *h.RecordDecisionTaskStartedResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -166,7 +166,7 @@ func (c *clientImpl) RecordActivityTaskStarted( if err != nil { return nil, err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) var response *h.RecordActivityTaskStartedResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -194,7 +194,7 @@ func (c *clientImpl) RespondDecisionTaskCompleted( if err != nil { return err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -216,7 +216,7 @@ func (c *clientImpl) RespondDecisionTaskFailed( if err != nil { return err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -238,7 +238,7 @@ func (c *clientImpl) RespondActivityTaskCompleted( if err != nil { return err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -260,7 +260,7 @@ func (c *clientImpl) RespondActivityTaskFailed( if err != nil { return err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -282,7 +282,7 @@ func (c *clientImpl) RespondActivityTaskCanceled( if err != nil { return err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -304,7 +304,7 @@ func (c *clientImpl) RecordActivityTaskHeartbeat( if err != nil { return nil, err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) var response *workflow.RecordActivityTaskHeartbeatResponse op := func(ctx context.Context, client historyserviceclient.Interface) error { var err error @@ -328,7 +328,7 @@ func (c *clientImpl) RequestCancelWorkflowExecution( if err != nil { return err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -345,7 +345,7 @@ func (c *clientImpl) SignalWorkflowExecution( if err != nil { return err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -364,7 +364,7 @@ func (c *clientImpl) TerminateWorkflowExecution( if err != nil { return err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -382,7 +382,7 @@ func (c *clientImpl) ScheduleDecisionTask( if err != nil { return err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -400,7 +400,7 @@ func (c *clientImpl) RecordChildExecutionCompleted( if err != nil { return err } - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) op := func(ctx context.Context, client historyserviceclient.Interface) error { ctx, cancel := c.createContext(ctx) defer cancel() @@ -476,16 +476,3 @@ redirectLoop: } return err } - -func aggregateYarpcOptions(ctx context.Context, opts ...yarpc.CallOption) []yarpc.CallOption { - var result []yarpc.CallOption - if ctx != nil { - call := yarpc.CallFromContext(ctx) - for _, key := range call.HeaderNames() { - value := call.Header(key) - result = append(result, yarpc.WithHeader(key, value)) - } - result = append(result, opts...) - } - return result -} diff --git a/client/matching/client.go b/client/matching/client.go index 1b4372e60e6..73f88df3441 100644 --- a/client/matching/client.go +++ b/client/matching/client.go @@ -61,7 +61,7 @@ func (c *clientImpl) AddActivityTask( ctx context.Context, addRequest *m.AddActivityTaskRequest, opts ...yarpc.CallOption) error { - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*addRequest.TaskList.Name) if err != nil { return err @@ -75,7 +75,7 @@ func (c *clientImpl) AddDecisionTask( ctx context.Context, addRequest *m.AddDecisionTaskRequest, opts ...yarpc.CallOption) error { - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*addRequest.TaskList.Name) if err != nil { return err @@ -89,7 +89,7 @@ func (c *clientImpl) PollForActivityTask( ctx context.Context, pollRequest *m.PollForActivityTaskRequest, opts ...yarpc.CallOption) (*workflow.PollForActivityTaskResponse, error) { - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*pollRequest.PollRequest.TaskList.Name) if err != nil { return nil, err @@ -103,7 +103,7 @@ func (c *clientImpl) PollForDecisionTask( ctx context.Context, pollRequest *m.PollForDecisionTaskRequest, opts ...yarpc.CallOption) (*m.PollForDecisionTaskResponse, error) { - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*pollRequest.PollRequest.TaskList.Name) if err != nil { return nil, err @@ -114,7 +114,7 @@ func (c *clientImpl) PollForDecisionTask( } func (c *clientImpl) QueryWorkflow(ctx context.Context, queryRequest *m.QueryWorkflowRequest, opts ...yarpc.CallOption) (*workflow.QueryWorkflowResponse, error) { - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*queryRequest.TaskList.Name) if err != nil { return nil, err @@ -125,7 +125,7 @@ func (c *clientImpl) QueryWorkflow(ctx context.Context, queryRequest *m.QueryWor } func (c *clientImpl) RespondQueryTaskCompleted(ctx context.Context, request *m.RespondQueryTaskCompletedRequest, opts ...yarpc.CallOption) error { - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*request.TaskList.Name) if err != nil { return err @@ -136,7 +136,7 @@ func (c *clientImpl) RespondQueryTaskCompleted(ctx context.Context, request *m.R } func (c *clientImpl) CancelOutstandingPoll(ctx context.Context, request *m.CancelOutstandingPollRequest, opts ...yarpc.CallOption) error { - opts = aggregateYarpcOptions(ctx, opts...) + opts = common.AggregateYarpcOptions(ctx, opts...) client, err := c.getHostForRequest(*request.TaskList.Name) if err != nil { return err @@ -194,16 +194,3 @@ func (c *clientImpl) getThriftClient(hostPort string) matchingserviceclient.Inte } return client } - -func aggregateYarpcOptions(ctx context.Context, opts ...yarpc.CallOption) []yarpc.CallOption { - var result []yarpc.CallOption - if ctx != nil { - call := yarpc.CallFromContext(ctx) - for _, key := range call.HeaderNames() { - value := call.Header(key) - result = append(result, yarpc.WithHeader(key, value)) - } - } - result = append(result, opts...) - return result -} diff --git a/common/rpc.go b/common/rpc.go index 20a1440f281..fc2a3a018a5 100644 --- a/common/rpc.go +++ b/common/rpc.go @@ -22,6 +22,7 @@ package common import ( "go.uber.org/yarpc" + "golang.org/x/net/context" ) const ( @@ -33,6 +34,10 @@ const ( // FeatureVersionHeaderName refers to the name of the // tchannel / http header that contains the client // feature version + // the feature version sent from client represents the + // feature set of the cadence client library support. + // This can be used for client capibility check, on + // Cadence server, for backward compatibility FeatureVersionHeaderName = "cadence-client-feature-version" // ClientImplHeaderName refers to the name of the @@ -47,3 +52,17 @@ type ( CreateDispatcherForOutbound(callerName, serviceName, hostName string) *yarpc.Dispatcher } ) + +// AggregateYarpcOptions aggregate the header information from context to existing yarpc call options +func AggregateYarpcOptions(ctx context.Context, opts ...yarpc.CallOption) []yarpc.CallOption { + var result []yarpc.CallOption + if ctx != nil { + call := yarpc.CallFromContext(ctx) + for _, key := range call.HeaderNames() { + value := call.Header(key) + result = append(result, yarpc.WithHeader(key, value)) + } + } + result = append(result, opts...) + return result +}