class Temporalio::Client::AsyncActivityHandle

{Client.async_activity_handle}.
Handle representing an external activity for completion and heartbeat. This is usually created via

def complete(result = nil, rpc_options: nil)

Parameters:
  • rpc_options (RPCOptions, nil) -- Advanced RPC options.
  • result (Object, nil) -- Result of the activity.
def complete(result = nil, rpc_options: nil)
  @client._impl.complete_async_activity(Interceptor::CompleteAsyncActivityInput.new(
                                          task_token_or_id_reference:,
                                          result:,
                                          rpc_options:
                                        ))
end

def fail(error, last_heartbeat_details: [], rpc_options: nil)

Parameters:
  • rpc_options (RPCOptions, nil) -- Advanced RPC options.
  • last_heartbeat_details (Array) -- Last heartbeat details for the activity.
  • error (Exception) -- Error for the activity.
  • def fail(error, last_heartbeat_details: [], rpc_options: nil)
      @client._impl.fail_async_activity(Interceptor::FailAsyncActivityInput.new(
                                          task_token_or_id_reference:,
                                          error:,
                                          last_heartbeat_details:,
                                          rpc_options:
                                        ))
    end

    def heartbeat(*details, rpc_options: nil)

    Parameters:
    • rpc_options (RPCOptions, nil) -- Advanced RPC options.
    • details (Array) -- Details of the heartbeat.
      def heartbeat(*details, rpc_options: nil)
        @client._impl.heartbeat_async_activity(Interceptor::HeartbeatAsyncActivityInput.new(
                                                 task_token_or_id_reference:,
                                                 details:,
                                                 rpc_options:
                                               ))
      end

      def initialize(client:, task_token:, id_reference:)

      @!visibility private
      def initialize(client:, task_token:, id_reference:)
        @client = client
        @task_token = task_token
        @id_reference = id_reference
      end

      def report_cancellation(*details, rpc_options: nil)

      Raises:
      • (AsyncActivityCanceledError) - If the activity has been canceled.

      Parameters:
      • rpc_options (RPCOptions, nil) -- Advanced RPC options.
      • details (Array) -- Cancellation details.
        def report_cancellation(*details, rpc_options: nil)
          @client._impl.report_cancellation_async_activity(Interceptor::ReportCancellationAsyncActivityInput.new(
                                                             task_token_or_id_reference:,
                                                             details:,
                                                             rpc_options:
                                                           ))
        end

        def task_token_or_id_reference

        def task_token_or_id_reference
          @task_token || @id_reference or raise
        end