Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HandlerErrorRetryBehavior #551

Merged
merged 3 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions openapi/openapiv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -8967,9 +8967,22 @@
},
"failure": {
"$ref": "#/definitions/apinexusv1Failure"
},
"retryBehavior": {
"$ref": "#/definitions/v1HandlerErrorRetryBehavior"
}
}
},
"v1HandlerErrorRetryBehavior": {
"type": "string",
"enum": [
"HANDLER_ERROR_RETRY_BEHAVIOR_UNSPECIFIED",
"HANDLER_ERROR_RETRY_BEHAVIOR_RETRYABLE",
"HANDLER_ERROR_RETRY_BEHAVIOR_NON_RETRYABLE"
],
"default": "HANDLER_ERROR_RETRY_BEHAVIOR_UNSPECIFIED",
"description": "HandlerErrorRetryBehavior allows handlers to explicity set the retry behavior of a HandlerError. If not specified,\nretry behavior is determined from the error type. For example internal errors are not retryable by default unless\nspecified otherwise.\n\n - HANDLER_ERROR_RETRY_BEHAVIOR_RETRYABLE: A handler error is explicitly marked as retryable.\n - HANDLER_ERROR_RETRY_BEHAVIOR_NON_RETRYABLE: A handler error is explicitly marked as non-retryable."
},
"v1Header": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -9762,6 +9775,10 @@
"type": {
"type": "string",
"description": "The Nexus error type as defined in the spec:\nhttps://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors."
},
"retryBehavior": {
"$ref": "#/definitions/v1HandlerErrorRetryBehavior",
"description": "Retry behavior, defaults to the retry behavior of the error type as defined in the spec."
}
}
},
Expand Down
272 changes: 76 additions & 196 deletions openapi/openapiv3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4894,31 +4894,6 @@ paths:
$ref: '#/components/schemas/Status'
components:
schemas:
ActivityFailureInfo:
type: object
properties:
scheduledEventId:
type: string
startedEventId:
type: string
identity:
type: string
activityType:
$ref: '#/components/schemas/ActivityType'
activityId:
type: string
retryState:
enum:
- RETRY_STATE_UNSPECIFIED
- RETRY_STATE_IN_PROGRESS
- RETRY_STATE_NON_RETRYABLE_FAILURE
- RETRY_STATE_TIMEOUT
- RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED
- RETRY_STATE_RETRY_POLICY_NOT_SET
- RETRY_STATE_INTERNAL_SERVER_ERROR
- RETRY_STATE_CANCEL_REQUESTED
type: string
format: enum
ActivityOptions:
type: object
properties:
Expand Down Expand Up @@ -5210,23 +5185,6 @@ components:
type: string
format: enum
description: Alert contains notification and severity.
ApplicationFailureInfo:
type: object
properties:
type:
type: string
nonRetryable:
type: boolean
details:
$ref: '#/components/schemas/Payloads'
nextRetryDelay:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
description: |-
next_retry_delay can be used by the client to override the activity
retry interval calculated by the retry policy. Retry attempts will
still be subject to the maximum retries limit and total time limit
defined by the policy.
BackfillRequest:
type: object
properties:
Expand Down Expand Up @@ -5621,11 +5579,25 @@ components:
additionalProperties:
type: string
description: Header to attach to callback request.
CanceledFailureInfo:
CancelOperationRequest:
type: object
properties:
details:
$ref: '#/components/schemas/Payloads'
service:
type: string
description: Service name.
operation:
type: string
description: Type of operation to cancel.
operationId:
type: string
description: |-
Operation ID as originally generated by a Handler.

Deprecated: Renamed to operation_token.
operationToken:
type: string
description: Operation token as originally generated by a Handler.
description: A request to cancel an operation.
ChildWorkflowExecutionCanceledEventAttributes:
type: object
properties:
Expand Down Expand Up @@ -5704,31 +5676,6 @@ components:
- RETRY_STATE_CANCEL_REQUESTED
type: string
format: enum
ChildWorkflowExecutionFailureInfo:
type: object
properties:
namespace:
type: string
workflowExecution:
$ref: '#/components/schemas/WorkflowExecution'
workflowType:
$ref: '#/components/schemas/WorkflowType'
initiatedEventId:
type: string
startedEventId:
type: string
retryState:
enum:
- RETRY_STATE_UNSPECIFIED
- RETRY_STATE_IN_PROGRESS
- RETRY_STATE_NON_RETRYABLE_FAILURE
- RETRY_STATE_TIMEOUT
- RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED
- RETRY_STATE_RETRY_POLICY_NOT_SET
- RETRY_STATE_INTERNAL_SERVER_ERROR
- RETRY_STATE_CANCEL_REQUESTED
type: string
format: enum
ChildWorkflowExecutionStartedEventAttributes:
type: object
properties:
Expand Down Expand Up @@ -6373,53 +6320,17 @@ components:
properties:
message:
type: string
source:
type: string
description: |-
The source this Failure originated in, e.g. TypeScriptSDK / JavaSDK
In some SDKs this is used to rehydrate the stack trace into an exception object.
stackTrace:
metadata:
type: object
additionalProperties:
type: string
details:
type: string
encodedAttributes:
allOf:
- $ref: '#/components/schemas/Payload'
description: |-
Alternative way to supply `message` and `stack_trace` and possibly other attributes, used for encryption of
errors originating in user code which might contain sensitive information.
The `encoded_attributes` Payload could represent any serializable object, e.g. JSON object or a `Failure` proto
message.

SDK authors:
- The SDK should provide a default `encodeFailureAttributes` and `decodeFailureAttributes` implementation that:
- Uses a JSON object to represent `{ message, stack_trace }`.
- Overwrites the original message with "Encoded failure" to indicate that more information could be extracted.
- Overwrites the original stack_trace with an empty string.
- The resulting JSON object is converted to Payload using the default PayloadConverter and should be processed
by the user-provided PayloadCodec

- If there's demand, we could allow overriding the default SDK implementation to encode other opaque Failure attributes.
cause:
$ref: '#/components/schemas/Failure'
applicationFailureInfo:
$ref: '#/components/schemas/ApplicationFailureInfo'
timeoutFailureInfo:
$ref: '#/components/schemas/TimeoutFailureInfo'
canceledFailureInfo:
$ref: '#/components/schemas/CanceledFailureInfo'
terminatedFailureInfo:
$ref: '#/components/schemas/TerminatedFailureInfo'
serverFailureInfo:
$ref: '#/components/schemas/ServerFailureInfo'
resetWorkflowFailureInfo:
$ref: '#/components/schemas/ResetWorkflowFailureInfo'
activityFailureInfo:
$ref: '#/components/schemas/ActivityFailureInfo'
childWorkflowExecutionFailureInfo:
$ref: '#/components/schemas/ChildWorkflowExecutionFailureInfo'
nexusOperationExecutionFailureInfo:
$ref: '#/components/schemas/NexusOperationFailureInfo'
nexusHandlerFailureInfo:
$ref: '#/components/schemas/NexusHandlerFailureInfo'
description: UTF-8 encoded JSON serializable details.
format: bytes
description: |-
A general purpose failure message.
See: https://github.com/nexus-rpc/api/blob/main/SPEC.md#failure
GetClusterInfoResponse:
type: object
properties:
Expand Down Expand Up @@ -6847,22 +6758,6 @@ components:
description: |-
History events are the method by which Temporal SDKs advance (or recreate) workflow state.
See the `EventType` enum for more info about what each event is for.
Input:
type: object
properties:
header:
allOf:
- $ref: '#/components/schemas/Header'
description: |-
Headers that are passed with the Update from the requesting entity.
These can include things like auth or tracing tokens.
name:
type: string
description: The name of the Update handler to invoke on the target Workflow.
args:
allOf:
- $ref: '#/components/schemas/Payloads'
description: The arguments to pass to the named Update handler.
IntervalSpec:
type: object
properties:
Expand Down Expand Up @@ -7269,14 +7164,6 @@ components:
description: |-
NewWorkflowExecutionInfo is a shared message that encapsulates all the
required arguments to starting a workflow in different contexts.
NexusHandlerFailureInfo:
type: object
properties:
type:
type: string
description: |-
The Nexus error type as defined in the spec:
https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors.
NexusOperationCancelRequestedEventAttributes:
type: object
properties:
Expand Down Expand Up @@ -7372,30 +7259,6 @@ components:
type: string
description: The request ID allocated at schedule time.
description: Nexus operation failed.
NexusOperationFailureInfo:
type: object
properties:
scheduledEventId:
type: string
description: The NexusOperationScheduled event ID.
endpoint:
type: string
description: Endpoint name.
service:
type: string
description: Service name.
operation:
type: string
description: Operation name.
operationId:
type: string
description: |-
Operation ID - may be empty if the operation completed synchronously.

Deprecated: Renamed to operation_token.
operationToken:
type: string
description: Operation token - may be empty if the operation completed synchronously.
NexusOperationScheduledEventAttributes:
type: object
properties:
Expand Down Expand Up @@ -8063,11 +7926,25 @@ components:
Request:
type: object
properties:
meta:
$ref: '#/components/schemas/Meta'
input:
$ref: '#/components/schemas/Input'
description: The client request that triggers a Workflow Update.
header:
type: object
additionalProperties:
type: string
description: |-
Headers extracted from the original request in the Temporal frontend.
When using Nexus over HTTP, this includes the request's HTTP headers ignoring multiple values.
scheduledTime:
type: string
description: |-
The timestamp when the request was scheduled in the frontend.
(-- api-linter: core::0142::time-field-names=disabled
aip.dev/not-precedent: Not following linter rules. --)
format: date-time
startOperation:
$ref: '#/components/schemas/StartOperationRequest'
cancelOperation:
$ref: '#/components/schemas/CancelOperationRequest'
description: A Nexus request.
RequestCancelExternalWorkflowExecutionFailedEventAttributes:
type: object
properties:
Expand Down Expand Up @@ -8327,11 +8204,6 @@ components:
properties:
runId:
type: string
ResetWorkflowFailureInfo:
type: object
properties:
lastHeartbeatDetails:
$ref: '#/components/schemas/Payloads'
RespondActivityTaskCanceledByIdRequest:
type: object
properties:
Expand Down Expand Up @@ -8922,11 +8794,6 @@ components:
description: |-
A user-defined set of *indexed* fields that are used/exposed when listing/searching workflows.
The payload is not serialized in a user-defined way.
ServerFailureInfo:
type: object
properties:
nonRetryable:
type: boolean
SetCurrentDeploymentRequest:
type: object
properties:
Expand Down Expand Up @@ -9324,6 +9191,36 @@ components:
description: |-
If this is set, the child workflow inherits the Build ID of the parent. Otherwise, the assignment
rules of the child's Task Queue will be used to independently assign a Build ID to it.
StartOperationRequest:
type: object
properties:
service:
type: string
description: Name of service to start the operation in.
operation:
type: string
description: Type of operation to start.
requestId:
type: string
description: A request ID that can be used as an idempotentency key.
callback:
type: string
description: Callback URL to call upon completion if the started operation is async.
payload:
allOf:
- $ref: '#/components/schemas/Payload'
description: Full request body from the incoming HTTP request.
callbackHeader:
type: object
additionalProperties:
type: string
description: Header that is expected to be attached to the callback request when the operation completes.
links:
type: array
items:
$ref: '#/components/schemas/Link'
description: Links contain caller information and can be attached to the operations started by the handler.
description: A request to start an operation.
StartWorkflowExecutionRequest:
type: object
properties:
Expand Down Expand Up @@ -9750,23 +9647,6 @@ components:
TerminateWorkflowExecutionResponse:
type: object
properties: {}
TerminatedFailureInfo:
type: object
properties: {}
TimeoutFailureInfo:
type: object
properties:
timeoutType:
enum:
- TIMEOUT_TYPE_UNSPECIFIED
- TIMEOUT_TYPE_START_TO_CLOSE
- TIMEOUT_TYPE_SCHEDULE_TO_START
- TIMEOUT_TYPE_SCHEDULE_TO_CLOSE
- TIMEOUT_TYPE_HEARTBEAT
type: string
format: enum
lastHeartbeatDetails:
$ref: '#/components/schemas/Payloads'
TimerCanceledEventAttributes:
type: object
properties:
Expand Down
Loading
Loading