temporalio 0.2.0-arm64-darwin → 0.4.0-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +2 -0
- data/Gemfile +7 -3
- data/Rakefile +10 -296
- data/lib/temporalio/activity/complete_async_error.rb +1 -1
- data/lib/temporalio/activity/context.rb +18 -2
- data/lib/temporalio/activity/definition.rb +180 -65
- data/lib/temporalio/activity/info.rb +25 -21
- data/lib/temporalio/activity.rb +2 -59
- data/lib/temporalio/api/activity/v1/message.rb +25 -0
- data/lib/temporalio/api/batch/v1/message.rb +6 -1
- data/lib/temporalio/api/cloud/account/v1/message.rb +28 -0
- data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +34 -1
- data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +1 -1
- data/lib/temporalio/api/cloud/identity/v1/message.rb +6 -1
- data/lib/temporalio/api/cloud/namespace/v1/message.rb +8 -1
- data/lib/temporalio/api/cloud/nexus/v1/message.rb +31 -0
- data/lib/temporalio/api/cloud/operation/v1/message.rb +2 -1
- data/lib/temporalio/api/cloud/region/v1/message.rb +2 -1
- data/lib/temporalio/api/cloud/resource/v1/message.rb +23 -0
- data/lib/temporalio/api/cloud/sink/v1/message.rb +24 -0
- data/lib/temporalio/api/cloud/usage/v1/message.rb +31 -0
- data/lib/temporalio/api/command/v1/message.rb +1 -1
- data/lib/temporalio/api/common/v1/message.rb +8 -1
- data/lib/temporalio/api/deployment/v1/message.rb +38 -0
- data/lib/temporalio/api/enums/v1/batch_operation.rb +1 -1
- data/lib/temporalio/api/enums/v1/common.rb +1 -1
- data/lib/temporalio/api/enums/v1/deployment.rb +23 -0
- data/lib/temporalio/api/enums/v1/event_type.rb +1 -1
- data/lib/temporalio/api/enums/v1/failed_cause.rb +1 -1
- data/lib/temporalio/api/enums/v1/nexus.rb +21 -0
- data/lib/temporalio/api/enums/v1/reset.rb +1 -1
- data/lib/temporalio/api/enums/v1/workflow.rb +2 -1
- data/lib/temporalio/api/errordetails/v1/message.rb +3 -1
- data/lib/temporalio/api/failure/v1/message.rb +3 -1
- data/lib/temporalio/api/history/v1/message.rb +3 -1
- data/lib/temporalio/api/nexus/v1/message.rb +3 -2
- data/lib/temporalio/api/operatorservice/v1/service.rb +1 -1
- data/lib/temporalio/api/payload_visitor.rb +1581 -0
- data/lib/temporalio/api/query/v1/message.rb +2 -1
- data/lib/temporalio/api/schedule/v1/message.rb +2 -1
- data/lib/temporalio/api/taskqueue/v1/message.rb +4 -1
- data/lib/temporalio/api/testservice/v1/request_response.rb +31 -0
- data/lib/temporalio/api/testservice/v1/service.rb +23 -0
- data/lib/temporalio/api/workflow/v1/message.rb +9 -1
- data/lib/temporalio/api/workflowservice/v1/request_response.rb +46 -2
- data/lib/temporalio/api/workflowservice/v1/service.rb +1 -1
- data/lib/temporalio/api.rb +2 -0
- data/lib/temporalio/cancellation.rb +34 -14
- data/lib/temporalio/client/async_activity_handle.rb +12 -37
- data/lib/temporalio/client/connection/cloud_service.rb +309 -231
- data/lib/temporalio/client/connection/operator_service.rb +36 -84
- data/lib/temporalio/client/connection/service.rb +6 -5
- data/lib/temporalio/client/connection/test_service.rb +111 -0
- data/lib/temporalio/client/connection/workflow_service.rb +474 -441
- data/lib/temporalio/client/connection.rb +90 -44
- data/lib/temporalio/client/interceptor.rb +199 -60
- data/lib/temporalio/client/schedule.rb +991 -0
- data/lib/temporalio/client/schedule_handle.rb +126 -0
- data/lib/temporalio/client/with_start_workflow_operation.rb +115 -0
- data/lib/temporalio/client/workflow_execution.rb +26 -10
- data/lib/temporalio/client/workflow_handle.rb +41 -98
- data/lib/temporalio/client/workflow_update_handle.rb +3 -5
- data/lib/temporalio/client.rb +247 -44
- data/lib/temporalio/common_enums.rb +17 -0
- data/lib/temporalio/contrib/open_telemetry.rb +470 -0
- data/lib/temporalio/converters/data_converter.rb +4 -7
- data/lib/temporalio/converters/failure_converter.rb +5 -3
- data/lib/temporalio/converters/payload_converter/composite.rb +4 -0
- data/lib/temporalio/converters/payload_converter.rb +6 -8
- data/lib/temporalio/converters/raw_value.rb +20 -0
- data/lib/temporalio/error/failure.rb +1 -1
- data/lib/temporalio/error.rb +11 -2
- data/lib/temporalio/internal/bridge/3.2/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/3.3/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/{3.1 → 3.4}/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +1 -1
- data/lib/temporalio/internal/bridge/api/common/common.rb +2 -1
- data/lib/temporalio/internal/bridge/api/core_interface.rb +5 -1
- data/lib/temporalio/internal/bridge/api/nexus/nexus.rb +33 -0
- data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +5 -1
- data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +4 -1
- data/lib/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rb +2 -1
- data/lib/temporalio/internal/bridge/client.rb +11 -6
- data/lib/temporalio/internal/bridge/runtime.rb +3 -0
- data/lib/temporalio/internal/bridge/testing.rb +23 -0
- data/lib/temporalio/internal/bridge/worker.rb +2 -0
- data/lib/temporalio/internal/bridge.rb +1 -1
- data/lib/temporalio/internal/client/implementation.rb +468 -71
- data/lib/temporalio/internal/metric.rb +122 -0
- data/lib/temporalio/internal/proto_utils.rb +118 -7
- data/lib/temporalio/internal/worker/activity_worker.rb +69 -29
- data/lib/temporalio/internal/worker/multi_runner.rb +53 -9
- data/lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb +54 -0
- data/lib/temporalio/internal/worker/workflow_instance/context.rb +383 -0
- data/lib/temporalio/internal/worker/workflow_instance/details.rb +46 -0
- data/lib/temporalio/internal/worker/workflow_instance/external_workflow_handle.rb +32 -0
- data/lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb +22 -0
- data/lib/temporalio/internal/worker/workflow_instance/handler_execution.rb +25 -0
- data/lib/temporalio/internal/worker/workflow_instance/handler_hash.rb +41 -0
- data/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb +97 -0
- data/lib/temporalio/internal/worker/workflow_instance/inbound_implementation.rb +62 -0
- data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +400 -0
- data/lib/temporalio/internal/worker/workflow_instance/replay_safe_logger.rb +37 -0
- data/lib/temporalio/internal/worker/workflow_instance/replay_safe_metric.rb +40 -0
- data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +183 -0
- data/lib/temporalio/internal/worker/workflow_instance.rb +774 -0
- data/lib/temporalio/internal/worker/workflow_worker.rb +239 -0
- data/lib/temporalio/metric.rb +109 -0
- data/lib/temporalio/retry_policy.rb +37 -14
- data/lib/temporalio/runtime/metric_buffer.rb +94 -0
- data/lib/temporalio/runtime.rb +160 -79
- data/lib/temporalio/search_attributes.rb +93 -37
- data/lib/temporalio/testing/activity_environment.rb +44 -16
- data/lib/temporalio/testing/workflow_environment.rb +276 -7
- data/lib/temporalio/version.rb +1 -1
- data/lib/temporalio/worker/activity_executor/thread_pool.rb +9 -217
- data/lib/temporalio/worker/activity_executor.rb +3 -3
- data/lib/temporalio/worker/interceptor.rb +343 -66
- data/lib/temporalio/worker/thread_pool.rb +237 -0
- data/lib/temporalio/worker/tuner.rb +38 -0
- data/lib/temporalio/worker/workflow_executor/thread_pool.rb +235 -0
- data/lib/temporalio/worker/workflow_executor.rb +26 -0
- data/lib/temporalio/worker/workflow_replayer.rb +350 -0
- data/lib/temporalio/worker.rb +235 -58
- data/lib/temporalio/workflow/activity_cancellation_type.rb +20 -0
- data/lib/temporalio/workflow/child_workflow_cancellation_type.rb +21 -0
- data/lib/temporalio/workflow/child_workflow_handle.rb +43 -0
- data/lib/temporalio/workflow/definition.rb +598 -0
- data/lib/temporalio/workflow/external_workflow_handle.rb +41 -0
- data/lib/temporalio/workflow/future.rb +151 -0
- data/lib/temporalio/workflow/handler_unfinished_policy.rb +13 -0
- data/lib/temporalio/workflow/info.rb +104 -0
- data/lib/temporalio/workflow/parent_close_policy.rb +19 -0
- data/lib/temporalio/workflow/update_info.rb +20 -0
- data/lib/temporalio/workflow.rb +575 -0
- data/lib/temporalio/workflow_history.rb +26 -1
- data/lib/temporalio.rb +4 -0
- data/temporalio.gemspec +4 -3
- metadata +75 -8
| @@ -36,8 +36,7 @@ module Temporalio | |
| 36 36 | 
             
                  # Wait for and return the result of the update. The result may already be known in which case no network call is
         | 
| 37 37 | 
             
                  # made. Otherwise the result will be polled for until it is returned.
         | 
| 38 38 | 
             
                  #
         | 
| 39 | 
            -
                  # @param  | 
| 40 | 
            -
                  # @param rpc_timeout [Float, nil] Number of seconds before timeout.
         | 
| 39 | 
            +
                  # @param rpc_options [RPCOptions, nil] Advanced RPC options.
         | 
| 41 40 | 
             
                  #
         | 
| 42 41 | 
             
                  # @return [Object, nil] Update result.
         | 
| 43 42 | 
             
                  #
         | 
| @@ -45,13 +44,12 @@ module Temporalio | |
| 45 44 | 
             
                  # @raise [Error::WorkflowUpdateRPCTimeoutOrCanceledError] This update call timed out or was canceled. This doesn't
         | 
| 46 45 | 
             
                  #   mean the update itself was timed out or canceled.
         | 
| 47 46 | 
             
                  # @raise [Error::RPCError] RPC error from call.
         | 
| 48 | 
            -
                  def result( | 
| 47 | 
            +
                  def result(rpc_options: nil)
         | 
| 49 48 | 
             
                    @known_outcome ||= @client._impl.poll_workflow_update(Interceptor::PollWorkflowUpdateInput.new(
         | 
| 50 49 | 
             
                                                                            workflow_id:,
         | 
| 51 50 | 
             
                                                                            run_id: workflow_run_id,
         | 
| 52 51 | 
             
                                                                            update_id: id,
         | 
| 53 | 
            -
                                                                             | 
| 54 | 
            -
                                                                            rpc_timeout:
         | 
| 52 | 
            +
                                                                            rpc_options:
         | 
| 55 53 | 
             
                                                                          ))
         | 
| 56 54 |  | 
| 57 55 | 
             
                    if @known_outcome.failure
         | 
    
        data/lib/temporalio/client.rb
    CHANGED
    
    | @@ -6,10 +6,15 @@ require 'temporalio/api' | |
| 6 6 | 
             
            require 'temporalio/client/async_activity_handle'
         | 
| 7 7 | 
             
            require 'temporalio/client/connection'
         | 
| 8 8 | 
             
            require 'temporalio/client/interceptor'
         | 
| 9 | 
            +
            require 'temporalio/client/schedule'
         | 
| 10 | 
            +
            require 'temporalio/client/schedule_handle'
         | 
| 11 | 
            +
            require 'temporalio/client/with_start_workflow_operation'
         | 
| 9 12 | 
             
            require 'temporalio/client/workflow_execution'
         | 
| 10 13 | 
             
            require 'temporalio/client/workflow_execution_count'
         | 
| 11 14 | 
             
            require 'temporalio/client/workflow_handle'
         | 
| 12 15 | 
             
            require 'temporalio/client/workflow_query_reject_condition'
         | 
| 16 | 
            +
            require 'temporalio/client/workflow_update_handle'
         | 
| 17 | 
            +
            require 'temporalio/client/workflow_update_wait_stage'
         | 
| 13 18 | 
             
            require 'temporalio/common_enums'
         | 
| 14 19 | 
             
            require 'temporalio/converters'
         | 
| 15 20 | 
             
            require 'temporalio/error'
         | 
| @@ -17,6 +22,7 @@ require 'temporalio/internal/client/implementation' | |
| 17 22 | 
             
            require 'temporalio/retry_policy'
         | 
| 18 23 | 
             
            require 'temporalio/runtime'
         | 
| 19 24 | 
             
            require 'temporalio/search_attributes'
         | 
| 25 | 
            +
            require 'temporalio/workflow/definition'
         | 
| 20 26 |  | 
| 21 27 | 
             
            module Temporalio
         | 
| 22 28 | 
             
              # Client for accessing Temporal.
         | 
| @@ -30,17 +36,18 @@ module Temporalio | |
| 30 36 | 
             
              # synchronous and asynchronous contexts. Internally they use callbacks based on {::Queue} which means they are
         | 
| 31 37 | 
             
              # Fiber-compatible.
         | 
| 32 38 | 
             
              class Client
         | 
| 33 | 
            -
                 | 
| 34 | 
            -
                Options = Struct.new(
         | 
| 39 | 
            +
                Options = Data.define(
         | 
| 35 40 | 
             
                  :connection,
         | 
| 36 41 | 
             
                  :namespace,
         | 
| 37 42 | 
             
                  :data_converter,
         | 
| 38 43 | 
             
                  :interceptors,
         | 
| 39 44 | 
             
                  :logger,
         | 
| 40 | 
            -
                  :default_workflow_query_reject_condition | 
| 41 | 
            -
                  keyword_init: true
         | 
| 45 | 
            +
                  :default_workflow_query_reject_condition
         | 
| 42 46 | 
             
                )
         | 
| 43 47 |  | 
| 48 | 
            +
                # Options as returned from {options} for +**to_h+ splat use in {initialize}. See {initialize} for details.
         | 
| 49 | 
            +
                class Options; end # rubocop:disable Lint/EmptyClass
         | 
| 50 | 
            +
             | 
| 44 51 | 
             
                # Connect to Temporal server. This is a shortcut for +Connection.new+ followed by +Client.new+.
         | 
| 45 52 | 
             
                #
         | 
| 46 53 | 
             
                # @param target_host [String] +host:port+ for the Temporal server. For local development, this is often
         | 
| @@ -151,7 +158,7 @@ module Temporalio | |
| 151 158 | 
             
                    default_workflow_query_reject_condition:
         | 
| 152 159 | 
             
                  ).freeze
         | 
| 153 160 | 
             
                  # Initialize interceptors
         | 
| 154 | 
            -
                  @impl = interceptors.reverse_each.reduce(Internal::Client::Implementation.new(self)) do |acc, int|
         | 
| 161 | 
            +
                  @impl = interceptors.reverse_each.reduce(Internal::Client::Implementation.new(self)) do |acc, int| # steep:ignore
         | 
| 155 162 | 
             
                    int.intercept_client(acc)
         | 
| 156 163 | 
             
                  end
         | 
| 157 164 | 
             
                end
         | 
| @@ -183,10 +190,16 @@ module Temporalio | |
| 183 190 |  | 
| 184 191 | 
             
                # Start a workflow and return its handle.
         | 
| 185 192 | 
             
                #
         | 
| 186 | 
            -
                # @param workflow [Workflow,  | 
| 193 | 
            +
                # @param workflow [Class<Workflow::Definition>, String, Symbol] Workflow definition class or workflow name.
         | 
| 187 194 | 
             
                # @param args [Array<Object>] Arguments to the workflow.
         | 
| 188 195 | 
             
                # @param id [String] Unique identifier for the workflow execution.
         | 
| 189 196 | 
             
                # @param task_queue [String] Task queue to run the workflow on.
         | 
| 197 | 
            +
                # @param static_summary [String, nil] Fixed single-line summary for this workflow execution that may appear in
         | 
| 198 | 
            +
                #   CLI/UI. This can be in single-line Temporal markdown format. This is currently experimental.
         | 
| 199 | 
            +
                # @param static_details [String, nil] Fixed details for this workflow execution that may appear in CLI/UI. This can
         | 
| 200 | 
            +
                #   be in Temporal markdown format and can be multiple lines. This is a fixed value on the workflow that cannot be
         | 
| 201 | 
            +
                #   updated. For details that can be updated, use {Workflow.current_details=} within the workflow. This is currently
         | 
| 202 | 
            +
                #   experimental.
         | 
| 190 203 | 
             
                # @param execution_timeout [Float, nil] Total workflow execution timeout in seconds including retries and continue
         | 
| 191 204 | 
             
                #   as new.
         | 
| 192 205 | 
             
                # @param run_timeout [Float, nil] Timeout of a single workflow run in seconds.
         | 
| @@ -197,14 +210,13 @@ module Temporalio | |
| 197 210 | 
             
                #   is set to terminate if running.
         | 
| 198 211 | 
             
                # @param retry_policy [RetryPolicy, nil] Retry policy for the workflow.
         | 
| 199 212 | 
             
                # @param cron_schedule [String, nil] Cron schedule. Users should use schedules instead of this.
         | 
| 200 | 
            -
                # @param memo [Hash | 
| 213 | 
            +
                # @param memo [Hash{String, Symbol => Object}, nil] Memo for the workflow.
         | 
| 201 214 | 
             
                # @param search_attributes [SearchAttributes, nil] Search attributes for the workflow.
         | 
| 202 215 | 
             
                # @param start_delay [Float, nil] Amount of time in seconds to wait before starting the workflow. This does not work
         | 
| 203 216 | 
             
                #   with `cron_schedule`.
         | 
| 204 217 | 
             
                # @param request_eager_start [Boolean] Potentially reduce the latency to start this workflow by encouraging the
         | 
| 205 218 | 
             
                #   server to start it on a local worker running with this same client. This is currently experimental.
         | 
| 206 | 
            -
                # @param  | 
| 207 | 
            -
                # @param rpc_timeout [Float, nil] Number of seconds before timeout.
         | 
| 219 | 
            +
                # @param rpc_options [RPCOptions, nil] Advanced RPC options.
         | 
| 208 220 | 
             
                #
         | 
| 209 221 | 
             
                # @return [WorkflowHandle] A workflow handle to the started workflow.
         | 
| 210 222 | 
             
                # @raise [Error::WorkflowAlreadyStartedError] Workflow already exists.
         | 
| @@ -214,6 +226,8 @@ module Temporalio | |
| 214 226 | 
             
                  *args,
         | 
| 215 227 | 
             
                  id:,
         | 
| 216 228 | 
             
                  task_queue:,
         | 
| 229 | 
            +
                  static_summary: nil,
         | 
| 230 | 
            +
                  static_details: nil,
         | 
| 217 231 | 
             
                  execution_timeout: nil,
         | 
| 218 232 | 
             
                  run_timeout: nil,
         | 
| 219 233 | 
             
                  task_timeout: nil,
         | 
| @@ -225,14 +239,15 @@ module Temporalio | |
| 225 239 | 
             
                  search_attributes: nil,
         | 
| 226 240 | 
             
                  start_delay: nil,
         | 
| 227 241 | 
             
                  request_eager_start: false,
         | 
| 228 | 
            -
                   | 
| 229 | 
            -
                  rpc_timeout: nil
         | 
| 242 | 
            +
                  rpc_options: nil
         | 
| 230 243 | 
             
                )
         | 
| 231 244 | 
             
                  @impl.start_workflow(Interceptor::StartWorkflowInput.new(
         | 
| 232 | 
            -
                                         workflow | 
| 245 | 
            +
                                         workflow: Workflow::Definition._workflow_type_from_workflow_parameter(workflow),
         | 
| 233 246 | 
             
                                         args:,
         | 
| 234 247 | 
             
                                         workflow_id: id,
         | 
| 235 248 | 
             
                                         task_queue:,
         | 
| 249 | 
            +
                                         static_summary:,
         | 
| 250 | 
            +
                                         static_details:,
         | 
| 236 251 | 
             
                                         execution_timeout:,
         | 
| 237 252 | 
             
                                         run_timeout:,
         | 
| 238 253 | 
             
                                         task_timeout:,
         | 
| @@ -245,17 +260,22 @@ module Temporalio | |
| 245 260 | 
             
                                         start_delay:,
         | 
| 246 261 | 
             
                                         request_eager_start:,
         | 
| 247 262 | 
             
                                         headers: {},
         | 
| 248 | 
            -
                                          | 
| 249 | 
            -
                                         rpc_timeout:
         | 
| 263 | 
            +
                                         rpc_options:
         | 
| 250 264 | 
             
                                       ))
         | 
| 251 265 | 
             
                end
         | 
| 252 266 |  | 
| 253 267 | 
             
                # Start a workflow and wait for its result. This is a shortcut for {start_workflow} + {WorkflowHandle.result}.
         | 
| 254 268 | 
             
                #
         | 
| 255 | 
            -
                # @param workflow [Workflow, String]  | 
| 269 | 
            +
                # @param workflow [Class<Workflow::Definition>, Symbol, String] Workflow definition class or workflow name.
         | 
| 256 270 | 
             
                # @param args [Array<Object>] Arguments to the workflow.
         | 
| 257 271 | 
             
                # @param id [String] Unique identifier for the workflow execution.
         | 
| 258 272 | 
             
                # @param task_queue [String] Task queue to run the workflow on.
         | 
| 273 | 
            +
                # @param static_summary [String, nil] Fixed single-line summary for this workflow execution that may appear in
         | 
| 274 | 
            +
                #   CLI/UI. This can be in single-line Temporal markdown format. This is currently experimental.
         | 
| 275 | 
            +
                # @param static_details [String, nil] Fixed details for this workflow execution that may appear in CLI/UI. This can
         | 
| 276 | 
            +
                #   be in Temporal markdown format and can be multiple lines. This is a fixed value on the workflow that cannot be
         | 
| 277 | 
            +
                #   updated. For details that can be updated, use {Workflow.current_details=} within the workflow. This is currently
         | 
| 278 | 
            +
                #   experimental.
         | 
| 259 279 | 
             
                # @param execution_timeout [Float, nil] Total workflow execution timeout in seconds including retries and continue
         | 
| 260 280 | 
             
                #   as new.
         | 
| 261 281 | 
             
                # @param run_timeout [Float, nil] Timeout of a single workflow run in seconds.
         | 
| @@ -266,14 +286,13 @@ module Temporalio | |
| 266 286 | 
             
                #   is set to terminate if running.
         | 
| 267 287 | 
             
                # @param retry_policy [RetryPolicy, nil] Retry policy for the workflow.
         | 
| 268 288 | 
             
                # @param cron_schedule [String, nil] Cron schedule. Users should use schedules instead of this.
         | 
| 269 | 
            -
                # @param memo [Hash | 
| 289 | 
            +
                # @param memo [Hash{String, Symbol => Object}, nil] Memo for the workflow.
         | 
| 270 290 | 
             
                # @param search_attributes [SearchAttributes, nil] Search attributes for the workflow.
         | 
| 271 291 | 
             
                # @param start_delay [Float, nil] Amount of time in seconds to wait before starting the workflow. This does not work
         | 
| 272 292 | 
             
                #   with `cron_schedule`.
         | 
| 273 293 | 
             
                # @param request_eager_start [Boolean] Potentially reduce the latency to start this workflow by encouraging the
         | 
| 274 294 | 
             
                #   server to start it on a local worker running with this same client. This is currently experimental.
         | 
| 275 | 
            -
                # @param  | 
| 276 | 
            -
                # @param rpc_timeout [Float, nil] Number of seconds before timeout.
         | 
| 295 | 
            +
                # @param rpc_options [RPCOptions, nil] Advanced RPC options.
         | 
| 277 296 | 
             
                #
         | 
| 278 297 | 
             
                # @return [Object] Successful result of the workflow.
         | 
| 279 298 | 
             
                # @raise [Error::WorkflowAlreadyStartedError] Workflow already exists.
         | 
| @@ -284,6 +303,8 @@ module Temporalio | |
| 284 303 | 
             
                  *args,
         | 
| 285 304 | 
             
                  id:,
         | 
| 286 305 | 
             
                  task_queue:,
         | 
| 306 | 
            +
                  static_summary: nil,
         | 
| 307 | 
            +
                  static_details: nil,
         | 
| 287 308 | 
             
                  execution_timeout: nil,
         | 
| 288 309 | 
             
                  run_timeout: nil,
         | 
| 289 310 | 
             
                  task_timeout: nil,
         | 
| @@ -295,14 +316,15 @@ module Temporalio | |
| 295 316 | 
             
                  search_attributes: nil,
         | 
| 296 317 | 
             
                  start_delay: nil,
         | 
| 297 318 | 
             
                  request_eager_start: false,
         | 
| 298 | 
            -
                   | 
| 299 | 
            -
                  rpc_timeout: nil
         | 
| 319 | 
            +
                  rpc_options: nil
         | 
| 300 320 | 
             
                )
         | 
| 301 321 | 
             
                  start_workflow(
         | 
| 302 322 | 
             
                    workflow,
         | 
| 303 323 | 
             
                    *args,
         | 
| 304 324 | 
             
                    id:,
         | 
| 305 325 | 
             
                    task_queue:,
         | 
| 326 | 
            +
                    static_summary:,
         | 
| 327 | 
            +
                    static_details:,
         | 
| 306 328 | 
             
                    execution_timeout:,
         | 
| 307 329 | 
             
                    run_timeout:,
         | 
| 308 330 | 
             
                    task_timeout:,
         | 
| @@ -314,8 +336,7 @@ module Temporalio | |
| 314 336 | 
             
                    search_attributes:,
         | 
| 315 337 | 
             
                    start_delay:,
         | 
| 316 338 | 
             
                    request_eager_start:,
         | 
| 317 | 
            -
                     | 
| 318 | 
            -
                    rpc_timeout:
         | 
| 339 | 
            +
                    rpc_options:
         | 
| 319 340 | 
             
                  ).result
         | 
| 320 341 | 
             
                end
         | 
| 321 342 |  | 
| @@ -336,52 +357,195 @@ module Temporalio | |
| 336 357 | 
             
                  WorkflowHandle.new(client: self, id: workflow_id, run_id:, result_run_id: run_id, first_execution_run_id:)
         | 
| 337 358 | 
             
                end
         | 
| 338 359 |  | 
| 360 | 
            +
                # Start an update, possibly starting the workflow at the same time if it doesn't exist (depending upon ID conflict
         | 
| 361 | 
            +
                # policy). Note that in some cases this may fail but the workflow will still be started, and the handle can then be
         | 
| 362 | 
            +
                # retrieved on the start workflow operation.
         | 
| 363 | 
            +
                #
         | 
| 364 | 
            +
                # @param update [Workflow::Definition::Update, Symbol, String] Update definition or name.
         | 
| 365 | 
            +
                # @param args [Array<Object>] Update arguments.
         | 
| 366 | 
            +
                # @param start_workflow_operation [WithStartWorkflowOperation] Required with-start workflow operation. This must
         | 
| 367 | 
            +
                #   have an `id_conflict_policy` set.
         | 
| 368 | 
            +
                # @param wait_for_stage [WorkflowUpdateWaitStage] Required stage to wait until returning. ADMITTED is not
         | 
| 369 | 
            +
                #   currently supported. See https://docs.temporal.io/workflows#update for more details.
         | 
| 370 | 
            +
                # @param id [String] ID of the update.
         | 
| 371 | 
            +
                # @param rpc_options [RPCOptions, nil] Advanced RPC options.
         | 
| 372 | 
            +
                #
         | 
| 373 | 
            +
                # @return [WorkflowUpdateHandle] The update handle.
         | 
| 374 | 
            +
                # @raise [Error::WorkflowAlreadyStartedError] Workflow already exists and conflict/reuse policy does not allow.
         | 
| 375 | 
            +
                # @raise [Error::WorkflowUpdateRPCTimeoutOrCanceledError] This update call timed out or was canceled. This doesn't
         | 
| 376 | 
            +
                #   mean the update itself was timed out or canceled, and this doesn't mean the workflow did not start.
         | 
| 377 | 
            +
                # @raise [Error::RPCError] RPC error from call.
         | 
| 378 | 
            +
                def start_update_with_start_workflow(
         | 
| 379 | 
            +
                  update,
         | 
| 380 | 
            +
                  *args,
         | 
| 381 | 
            +
                  start_workflow_operation:,
         | 
| 382 | 
            +
                  wait_for_stage:,
         | 
| 383 | 
            +
                  id: SecureRandom.uuid,
         | 
| 384 | 
            +
                  rpc_options: nil
         | 
| 385 | 
            +
                )
         | 
| 386 | 
            +
                  @impl.start_update_with_start_workflow(
         | 
| 387 | 
            +
                    Interceptor::StartUpdateWithStartWorkflowInput.new(
         | 
| 388 | 
            +
                      update_id: id,
         | 
| 389 | 
            +
                      update: Workflow::Definition::Update._name_from_parameter(update),
         | 
| 390 | 
            +
                      args:,
         | 
| 391 | 
            +
                      wait_for_stage:,
         | 
| 392 | 
            +
                      start_workflow_operation:,
         | 
| 393 | 
            +
                      headers: {},
         | 
| 394 | 
            +
                      rpc_options:
         | 
| 395 | 
            +
                    )
         | 
| 396 | 
            +
                  )
         | 
| 397 | 
            +
                end
         | 
| 398 | 
            +
             | 
| 399 | 
            +
                # Start an update, possibly starting the workflow at the same time if it doesn't exist (depending upon ID conflict
         | 
| 400 | 
            +
                # policy), and wait for update result. This is a shortcut for {start_update_with_start_workflow} +
         | 
| 401 | 
            +
                # {WorkflowUpdateHandle.result}.
         | 
| 402 | 
            +
                #
         | 
| 403 | 
            +
                # @param update [Workflow::Definition::Update, Symbol, String] Update definition or name.
         | 
| 404 | 
            +
                # @param args [Array<Object>] Update arguments.
         | 
| 405 | 
            +
                # @param start_workflow_operation [WithStartWorkflowOperation] Required with-start workflow operation. This must
         | 
| 406 | 
            +
                #   have an `id_conflict_policy` set.
         | 
| 407 | 
            +
                # @param id [String] ID of the update.
         | 
| 408 | 
            +
                # @param rpc_options [RPCOptions, nil] Advanced RPC options.
         | 
| 409 | 
            +
                #
         | 
| 410 | 
            +
                # @return [Object] Successful update result.
         | 
| 411 | 
            +
                # @raise [Error::WorkflowUpdateFailedError] If the update failed.
         | 
| 412 | 
            +
                # @raise [Error::WorkflowAlreadyStartedError] Workflow already exists and conflict/reuse policy does not allow.
         | 
| 413 | 
            +
                # @raise [Error::WorkflowUpdateRPCTimeoutOrCanceledError] This update call timed out or was canceled. This doesn't
         | 
| 414 | 
            +
                #   mean the update itself was timed out or canceled, and this doesn't mean the workflow did not start.
         | 
| 415 | 
            +
                # @raise [Error::RPCError] RPC error from call.
         | 
| 416 | 
            +
                def execute_update_with_start_workflow(
         | 
| 417 | 
            +
                  update,
         | 
| 418 | 
            +
                  *args,
         | 
| 419 | 
            +
                  start_workflow_operation:,
         | 
| 420 | 
            +
                  id: SecureRandom.uuid,
         | 
| 421 | 
            +
                  rpc_options: nil
         | 
| 422 | 
            +
                )
         | 
| 423 | 
            +
                  start_update_with_start_workflow(
         | 
| 424 | 
            +
                    update,
         | 
| 425 | 
            +
                    *args,
         | 
| 426 | 
            +
                    start_workflow_operation:,
         | 
| 427 | 
            +
                    wait_for_stage: WorkflowUpdateWaitStage::COMPLETED,
         | 
| 428 | 
            +
                    id:,
         | 
| 429 | 
            +
                    rpc_options:
         | 
| 430 | 
            +
                  ).result
         | 
| 431 | 
            +
                end
         | 
| 432 | 
            +
             | 
| 433 | 
            +
                # Send a signal, possibly starting the workflow at the same time if it doesn't exist.
         | 
| 434 | 
            +
                #
         | 
| 435 | 
            +
                # @param signal [Workflow::Definition::Signal, Symbol, String] Signal definition or name.
         | 
| 436 | 
            +
                # @param args [Array<Object>] Signal arguments.
         | 
| 437 | 
            +
                # @param start_workflow_operation [WithStartWorkflowOperation] Required with-start workflow operation. This may not
         | 
| 438 | 
            +
                #   support all `id_conflict_policy` options.
         | 
| 439 | 
            +
                # @param rpc_options [RPCOptions, nil] Advanced RPC options.
         | 
| 440 | 
            +
                #
         | 
| 441 | 
            +
                # @return [WorkflowHandle] A workflow handle to the workflow.
         | 
| 442 | 
            +
                # @raise [Error::WorkflowAlreadyStartedError] Workflow already exists and conflict/reuse policy does not allow.
         | 
| 443 | 
            +
                # @raise [Error::RPCError] RPC error from call.
         | 
| 444 | 
            +
                def signal_with_start_workflow(
         | 
| 445 | 
            +
                  signal,
         | 
| 446 | 
            +
                  *args,
         | 
| 447 | 
            +
                  start_workflow_operation:,
         | 
| 448 | 
            +
                  rpc_options: nil
         | 
| 449 | 
            +
                )
         | 
| 450 | 
            +
                  @impl.signal_with_start_workflow(
         | 
| 451 | 
            +
                    Interceptor::SignalWithStartWorkflowInput.new(
         | 
| 452 | 
            +
                      signal: Workflow::Definition::Signal._name_from_parameter(signal),
         | 
| 453 | 
            +
                      args:,
         | 
| 454 | 
            +
                      start_workflow_operation:,
         | 
| 455 | 
            +
                      rpc_options:
         | 
| 456 | 
            +
                    )
         | 
| 457 | 
            +
                  )
         | 
| 458 | 
            +
                end
         | 
| 459 | 
            +
             | 
| 339 460 | 
             
                # List workflows.
         | 
| 340 461 | 
             
                #
         | 
| 341 462 | 
             
                # @param query [String, nil] A Temporal visibility list filter.
         | 
| 342 | 
            -
                # @param  | 
| 343 | 
            -
                # @param rpc_timeout [Float, nil] Number of seconds before timeout.
         | 
| 463 | 
            +
                # @param rpc_options [RPCOptions, nil] Advanced RPC options.
         | 
| 344 464 | 
             
                #
         | 
| 345 465 | 
             
                # @return [Enumerator<WorkflowExecution>] Enumerable workflow executions.
         | 
| 346 466 | 
             
                #
         | 
| 347 467 | 
             
                # @raise [Error::RPCError] RPC error from call.
         | 
| 348 468 | 
             
                #
         | 
| 349 469 | 
             
                # @see https://docs.temporal.io/visibility
         | 
| 350 | 
            -
                def list_workflows(
         | 
| 351 | 
            -
                  query  | 
| 352 | 
            -
                  rpc_metadata: nil,
         | 
| 353 | 
            -
                  rpc_timeout: nil
         | 
| 354 | 
            -
                )
         | 
| 355 | 
            -
                  @impl.list_workflows(Interceptor::ListWorkflowsInput.new(
         | 
| 356 | 
            -
                                         query:,
         | 
| 357 | 
            -
                                         rpc_metadata:,
         | 
| 358 | 
            -
                                         rpc_timeout:
         | 
| 359 | 
            -
                                       ))
         | 
| 470 | 
            +
                def list_workflows(query = nil, rpc_options: nil)
         | 
| 471 | 
            +
                  @impl.list_workflows(Interceptor::ListWorkflowsInput.new(query:, rpc_options:))
         | 
| 360 472 | 
             
                end
         | 
| 361 473 |  | 
| 362 474 | 
             
                # Count workflows.
         | 
| 363 475 | 
             
                #
         | 
| 364 476 | 
             
                # @param query [String, nil] A Temporal visibility list filter.
         | 
| 365 | 
            -
                # @param  | 
| 366 | 
            -
                # @param rpc_timeout [Float, nil] Number of seconds before timeout.
         | 
| 477 | 
            +
                # @param rpc_options [RPCOptions, nil] Advanced RPC options.
         | 
| 367 478 | 
             
                #
         | 
| 368 479 | 
             
                # @return [WorkflowExecutionCount] Count of workflows.
         | 
| 369 480 | 
             
                #
         | 
| 370 481 | 
             
                # @raise [Error::RPCError] RPC error from call.
         | 
| 371 482 | 
             
                #
         | 
| 372 483 | 
             
                # @see https://docs.temporal.io/visibility
         | 
| 373 | 
            -
                def count_workflows(
         | 
| 374 | 
            -
                  query  | 
| 375 | 
            -
             | 
| 376 | 
            -
             | 
| 484 | 
            +
                def count_workflows(query = nil, rpc_options: nil)
         | 
| 485 | 
            +
                  @impl.count_workflows(Interceptor::CountWorkflowsInput.new(query:, rpc_options:))
         | 
| 486 | 
            +
                end
         | 
| 487 | 
            +
             | 
| 488 | 
            +
                # Create a schedule and return its handle.
         | 
| 489 | 
            +
                #
         | 
| 490 | 
            +
                # @param id [String] Unique identifier of the schedule.
         | 
| 491 | 
            +
                # @param schedule [Schedule] Schedule to create.
         | 
| 492 | 
            +
                # @param trigger_immediately [Boolean]  If true, trigger one action immediately when creating the schedule.
         | 
| 493 | 
            +
                # @param backfills [Array<Schedule::Backfill>] Set of time periods to take actions on as if that time passed right
         | 
| 494 | 
            +
                #   now.
         | 
| 495 | 
            +
                # @param memo [Hash<String, Object>, nil] Memo for the schedule. Memo for a scheduled workflow is part of the
         | 
| 496 | 
            +
                #   schedule action.
         | 
| 497 | 
            +
                # @param search_attributes [SearchAttributes, nil] Search attributes for the schedule. Search attributes for a
         | 
| 498 | 
            +
                #   scheduled workflow are part of the scheduled action.
         | 
| 499 | 
            +
                # @param rpc_options [RPCOptions, nil] Advanced RPC options.
         | 
| 500 | 
            +
                #
         | 
| 501 | 
            +
                # @return [ScheduleHandle] A handle to the created schedule.
         | 
| 502 | 
            +
                # @raise [Error::ScheduleAlreadyRunningError] If a schedule with this ID is already running.
         | 
| 503 | 
            +
                # @raise [Error::RPCError] RPC error from call.
         | 
| 504 | 
            +
                def create_schedule(
         | 
| 505 | 
            +
                  id,
         | 
| 506 | 
            +
                  schedule,
         | 
| 507 | 
            +
                  trigger_immediately: false,
         | 
| 508 | 
            +
                  backfills: [],
         | 
| 509 | 
            +
                  memo: nil,
         | 
| 510 | 
            +
                  search_attributes: nil,
         | 
| 511 | 
            +
                  rpc_options: nil
         | 
| 377 512 | 
             
                )
         | 
| 378 | 
            -
                  @impl. | 
| 379 | 
            -
                                           | 
| 380 | 
            -
                                           | 
| 381 | 
            -
                                           | 
| 513 | 
            +
                  @impl.create_schedule(Interceptor::CreateScheduleInput.new(
         | 
| 514 | 
            +
                                          id:,
         | 
| 515 | 
            +
                                          schedule:,
         | 
| 516 | 
            +
                                          trigger_immediately:,
         | 
| 517 | 
            +
                                          backfills:,
         | 
| 518 | 
            +
                                          memo:,
         | 
| 519 | 
            +
                                          search_attributes:,
         | 
| 520 | 
            +
                                          rpc_options:
         | 
| 382 521 | 
             
                                        ))
         | 
| 383 522 | 
             
                end
         | 
| 384 523 |  | 
| 524 | 
            +
                # Get a schedule handle to an existing schedule for the given ID.
         | 
| 525 | 
            +
                #
         | 
| 526 | 
            +
                # @param id [String] Schedule ID to get a handle to.
         | 
| 527 | 
            +
                # @return [ScheduleHandle] The schedule handle.
         | 
| 528 | 
            +
                def schedule_handle(id)
         | 
| 529 | 
            +
                  ScheduleHandle.new(client: self, id:)
         | 
| 530 | 
            +
                end
         | 
| 531 | 
            +
             | 
| 532 | 
            +
                # List schedules.
         | 
| 533 | 
            +
                #
         | 
| 534 | 
            +
                # Note, this list is eventually consistent. Therefore if a schedule is added or deleted, it may not be available in
         | 
| 535 | 
            +
                # the list immediately.
         | 
| 536 | 
            +
                #
         | 
| 537 | 
            +
                # @param query [String] A Temporal visibility list filter.
         | 
| 538 | 
            +
                # @param rpc_options [RPCOptions, nil] Advanced RPC options.
         | 
| 539 | 
            +
                #
         | 
| 540 | 
            +
                # @return [Enumerator<Schedule::List::Description>] Enumerable schedules.
         | 
| 541 | 
            +
                #
         | 
| 542 | 
            +
                # @raise [Error::RPCError] RPC error from call.
         | 
| 543 | 
            +
                #
         | 
| 544 | 
            +
                # @see https://docs.temporal.io/visibility
         | 
| 545 | 
            +
                def list_schedules(query = nil, rpc_options: nil)
         | 
| 546 | 
            +
                  @impl.list_schedules(Interceptor::ListSchedulesInput.new(query:, rpc_options:))
         | 
| 547 | 
            +
                end
         | 
| 548 | 
            +
             | 
| 385 549 | 
             
                # Get an async activity handle.
         | 
| 386 550 | 
             
                #
         | 
| 387 551 | 
             
                # @param task_token_or_id_reference [String, ActivityIDReference] Task token string or activity ID reference.
         | 
| @@ -400,5 +564,44 @@ module Temporalio | |
| 400 564 | 
             
                def _impl
         | 
| 401 565 | 
             
                  @impl
         | 
| 402 566 | 
             
                end
         | 
| 567 | 
            +
             | 
| 568 | 
            +
                # Set of RPC options for RPC calls.
         | 
| 569 | 
            +
                class RPCOptions
         | 
| 570 | 
            +
                  # @return [Hash<String, String>, nil] Headers to include on the RPC call.
         | 
| 571 | 
            +
                  attr_accessor :metadata
         | 
| 572 | 
            +
             | 
| 573 | 
            +
                  # @return [Float, nil] Number of seconds before timeout of the RPC call.
         | 
| 574 | 
            +
                  attr_accessor :timeout
         | 
| 575 | 
            +
             | 
| 576 | 
            +
                  # @return [Cancellation, nil] Cancellation to use to potentially cancel the call. If canceled, the RPC will return
         | 
| 577 | 
            +
                  #   {Error::CanceledError}.
         | 
| 578 | 
            +
                  attr_accessor :cancellation
         | 
| 579 | 
            +
             | 
| 580 | 
            +
                  # @return [Boolean, nil] Whether to override the default retry option which decides whether to retry calls
         | 
| 581 | 
            +
                  #   implicitly when known transient error codes are reached. By default when this is nil, high-level calls retry
         | 
| 582 | 
            +
                  #   known transient error codes and low-level/direct calls do not.
         | 
| 583 | 
            +
                  attr_accessor :override_retry
         | 
| 584 | 
            +
             | 
| 585 | 
            +
                  # Create RPC options.
         | 
| 586 | 
            +
                  #
         | 
| 587 | 
            +
                  # @param metadata [Hash<String, String>, nil] Headers to include on the RPC call.
         | 
| 588 | 
            +
                  # @param timeout [Float, nil] Number of seconds before timeout of the RPC call.
         | 
| 589 | 
            +
                  # @param cancellation [Cancellation, nil] Cancellation to use to potentially cancel the call. If canceled, the RPC
         | 
| 590 | 
            +
                  #   will return {Error::CanceledError}.
         | 
| 591 | 
            +
                  # @param override_retry [Boolean, nil] Whether to override the default retry option which decides whether to retry
         | 
| 592 | 
            +
                  #   calls implicitly when known transient error codes are reached. By default when this is nil, high-level calls
         | 
| 593 | 
            +
                  #   retry known transient error codes and low-level/direct calls do not.
         | 
| 594 | 
            +
                  def initialize(
         | 
| 595 | 
            +
                    metadata: nil,
         | 
| 596 | 
            +
                    timeout: nil,
         | 
| 597 | 
            +
                    cancellation: nil,
         | 
| 598 | 
            +
                    override_retry: nil
         | 
| 599 | 
            +
                  )
         | 
| 600 | 
            +
                    @metadata = metadata
         | 
| 601 | 
            +
                    @timeout = timeout
         | 
| 602 | 
            +
                    @cancellation = cancellation
         | 
| 603 | 
            +
                    @override_retry = override_retry
         | 
| 604 | 
            +
                  end
         | 
| 605 | 
            +
                end
         | 
| 403 606 | 
             
              end
         | 
| 404 607 | 
             
            end
         | 
| @@ -7,18 +7,35 @@ module Temporalio | |
| 7 7 | 
             
              #
         | 
| 8 8 | 
             
              # @see https://docs.temporal.io/workflows#workflow-id-reuse-policy
         | 
| 9 9 | 
             
              module WorkflowIDReusePolicy
         | 
| 10 | 
            +
                # Allow starting a workflow execution using the same workflow ID.
         | 
| 10 11 | 
             
                ALLOW_DUPLICATE = Api::Enums::V1::WorkflowIdReusePolicy::WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE
         | 
| 12 | 
            +
                # Allow starting a workflow execution using the same workflow ID, only when the last execution's final state is one
         | 
| 13 | 
            +
                # of terminated, canceled, timed out, or failed.
         | 
| 11 14 | 
             
                ALLOW_DUPLICATE_FAILED_ONLY =
         | 
| 12 15 | 
             
                  Api::Enums::V1::WorkflowIdReusePolicy::WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY
         | 
| 16 | 
            +
                # Do not permit re-use of the workflow ID for this workflow. Future start workflow requests could potentially change
         | 
| 17 | 
            +
                # the policy, allowing re-use of the workflow ID.
         | 
| 13 18 | 
             
                REJECT_DUPLICATE = Api::Enums::V1::WorkflowIdReusePolicy::WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE
         | 
| 19 | 
            +
                # This option is {WorkflowIDConflictPolicy::TERMINATE_EXISTING} but is here for backwards compatibility. If
         | 
| 20 | 
            +
                # specified, it acts like {ALLOW_DUPLICATE}, but also the {WorkflowIDConflictPolicy} on the request is treated as
         | 
| 21 | 
            +
                # {WorkflowIDConflictPolicy::TERMINATE_EXISTING}. If no running workflow, then the behavior is the same as
         | 
| 22 | 
            +
                # {ALLOW_DUPLICATE}.
         | 
| 23 | 
            +
                #
         | 
| 24 | 
            +
                # @deprecated Use {WorkflowIDConflictPolicy::TERMINATE_EXISTING} instead.
         | 
| 14 25 | 
             
                TERMINATE_IF_RUNNING = Api::Enums::V1::WorkflowIdReusePolicy::WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING
         | 
| 15 26 | 
             
              end
         | 
| 16 27 |  | 
| 17 28 | 
             
              # How already-running workflows of the same ID are handled on start.
         | 
| 29 | 
            +
              #
         | 
| 30 | 
            +
              # @see https://docs.temporal.io/workflows#workflow-id-conflict-policy
         | 
| 18 31 | 
             
              module WorkflowIDConflictPolicy
         | 
| 32 | 
            +
                # Unset.
         | 
| 19 33 | 
             
                UNSPECIFIED = Api::Enums::V1::WorkflowIdConflictPolicy::WORKFLOW_ID_CONFLICT_POLICY_UNSPECIFIED
         | 
| 34 | 
            +
                # Don't start a new workflow, instead fail with already-started error.
         | 
| 20 35 | 
             
                FAIL = Api::Enums::V1::WorkflowIdConflictPolicy::WORKFLOW_ID_CONFLICT_POLICY_FAIL
         | 
| 36 | 
            +
                # Don't start a new workflow, instead return a workflow handle for the running workflow.
         | 
| 21 37 | 
             
                USE_EXISTING = Api::Enums::V1::WorkflowIdConflictPolicy::WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING
         | 
| 38 | 
            +
                # Terminate the running workflow before starting a new one.
         | 
| 22 39 | 
             
                TERMINATE_EXISTING = Api::Enums::V1::WorkflowIdConflictPolicy::WORKFLOW_ID_CONFLICT_POLICY_TERMINATE_EXISTING
         | 
| 23 40 | 
             
              end
         | 
| 24 41 | 
             
            end
         |