Class: Temporalio::Internal::Worker::ActivityWorker::RunningActivity
- Inherits:
-
Activity::Context
- Object
- Activity::Context
- Temporalio::Internal::Worker::ActivityWorker::RunningActivity
- Defined in:
- lib/temporalio/internal/worker/activity_worker.rb
Instance Attribute Summary collapse
-
#_outbound_impl ⇒ Object
Returns the value of attribute _outbound_impl.
-
#_server_requested_cancel ⇒ Object
readonly
Returns the value of attribute _server_requested_cancel.
-
#cancellation ⇒ Object
readonly
Returns the value of attribute cancellation.
-
#cancellation_details ⇒ Object
readonly
Returns the value of attribute cancellation_details.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#instance ⇒ Object
Returns the value of attribute instance.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#payload_converter ⇒ Object
readonly
Returns the value of attribute payload_converter.
-
#worker_shutdown_cancellation ⇒ Object
readonly
Returns the value of attribute worker_shutdown_cancellation.
Instance Method Summary collapse
- #_cancel(reason:, details:) ⇒ Object
- #client ⇒ Object
- #heartbeat(*details, detail_hints: nil) ⇒ Object
-
#initialize(worker:, info:, cancellation:, worker_shutdown_cancellation:, payload_converter:, logger:, runtime_metric_meter:) ⇒ RunningActivity
constructor
rubocop:disable Lint/MissingSuper.
- #metric_meter ⇒ Object
Methods inherited from Activity::Context
current, current_or_nil, exist?
Constructor Details
#initialize(worker:, info:, cancellation:, worker_shutdown_cancellation:, payload_converter:, logger:, runtime_metric_meter:) ⇒ RunningActivity
rubocop:disable Lint/MissingSuper
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 361 def initialize( # rubocop:disable Lint/MissingSuper worker:, info:, cancellation:, worker_shutdown_cancellation:, payload_converter:, logger:, runtime_metric_meter: ) @worker = worker @info = info @cancellation = cancellation @cancellation_details = nil @worker_shutdown_cancellation = worker_shutdown_cancellation @payload_converter = payload_converter @logger = logger @runtime_metric_meter = runtime_metric_meter @_outbound_impl = nil @_server_requested_cancel = false end |
Instance Attribute Details
#_outbound_impl ⇒ Object
Returns the value of attribute _outbound_impl.
359 360 361 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 359 def _outbound_impl @_outbound_impl end |
#_server_requested_cancel ⇒ Object (readonly)
Returns the value of attribute _server_requested_cancel.
357 358 359 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 357 def _server_requested_cancel @_server_requested_cancel end |
#cancellation ⇒ Object (readonly)
Returns the value of attribute cancellation.
357 358 359 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 357 def cancellation @cancellation end |
#cancellation_details ⇒ Object (readonly)
Returns the value of attribute cancellation_details.
357 358 359 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 357 def cancellation_details @cancellation_details end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
357 358 359 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 357 def info @info end |
#instance ⇒ Object
Returns the value of attribute instance.
359 360 361 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 359 def instance @instance end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
357 358 359 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 357 def logger @logger end |
#payload_converter ⇒ Object (readonly)
Returns the value of attribute payload_converter.
357 358 359 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 357 def payload_converter @payload_converter end |
#worker_shutdown_cancellation ⇒ Object (readonly)
Returns the value of attribute worker_shutdown_cancellation.
357 358 359 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 357 def worker_shutdown_cancellation @worker_shutdown_cancellation end |
Instance Method Details
#_cancel(reason:, details:) ⇒ Object
407 408 409 410 411 412 413 414 415 416 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 407 def _cancel(reason:, details:) # Do not issue cancel if already canceled return if @cancellation_details @_server_requested_cancel = true # Set the cancellation details _before_ issuing the cancel itself @cancellation_details = details _, cancel_proc = cancellation cancel_proc.call(reason:) end |
#client ⇒ Object
403 404 405 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 403 def client @worker.client end |
#heartbeat(*details, detail_hints: nil) ⇒ Object
382 383 384 385 386 387 388 389 390 391 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 382 def heartbeat(*details, detail_hints: nil) raise 'Implementation not set yet' if _outbound_impl.nil? # No-op if local return if info.local? _outbound_impl.heartbeat( Temporalio::Worker::Interceptor::Activity::HeartbeatInput.new(details:, detail_hints:) ) end |
#metric_meter ⇒ Object
393 394 395 396 397 398 399 400 401 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 393 def metric_meter @metric_meter ||= @runtime_metric_meter.with_additional_attributes( { namespace: info.workflow_namespace, task_queue: info.task_queue, activity_type: info.activity_type } ) end |