Class: ActiveJob::Temporal::Configuration Private

Inherits:
Object
  • Object
show all
Defined in:
lib/activejob/temporal/configuration.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Note:

Thread Safety The global configuration object is synchronized by Configurable while configure blocks mutate it. Complete configuration during application boot.

Note:

Environment Variable Defaults ACTIVEJOB_TEMPORAL_TARGET, ACTIVEJOB_TEMPORAL_NAMESPACE, ACTIVEJOB_TEMPORAL_TASK_QUEUE_PREFIX, ACTIVEJOB_TEMPORAL_TASK_QUEUE, ACTIVEJOB_TEMPORAL_MAX_PAYLOAD_SIZE_KB, ACTIVEJOB_TEMPORAL_MAX_CONCURRENT_ACTIVITIES, ACTIVEJOB_TEMPORAL_MAX_CONCURRENT_WORKFLOW_TASKS, can provide defaults.

Configuration object for the activejob-temporal gem.

Holds connection settings, timeouts, retry policies, and operational flags. Use configure to set values with automatic validation.

See Also:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Configuration.



389
390
391
392
393
394
395
# File 'lib/activejob/temporal/configuration.rb', line 389

def initialize
  @attributes = {}
  @in_configure_block = false
  CONFIGURATION_ATTRIBUTES.each do |attribute, |
    @attributes[attribute] = resolve_default_value()
  end
end

Instance Attribute Details

#in_configure_blockObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



375
376
377
# File 'lib/activejob/temporal/configuration.rb', line 375

def in_configure_block
  @in_configure_block
end

Class Method Details

.format_validation_errors(errors) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



418
419
420
421
422
423
424
425
426
427
428
# File 'lib/activejob/temporal/configuration.rb', line 418

def self.format_validation_errors(errors)
  messages = errors.full_messages
  return messages.first if messages.size == 1

  error_list = messages.each_with_index.map do |message, index|
    "  #{index + 1}. #{message}"
  end.join("\n")

  plural = "s" if messages.size > 1
  "Configuration validation failed with #{messages.size} error#{plural}:\n#{error_list}"
end

Instance Method Details

#[](key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



397
398
399
# File 'lib/activejob/temporal/configuration.rb', line 397

def [](key)
  @attributes[key]
end

#[]=(key, value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



401
402
403
# File 'lib/activejob/temporal/configuration.rb', line 401

def []=(key, value)
  @attributes[key] = value
end

#add_middleware(middleware) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



405
406
407
# File 'lib/activejob/temporal/configuration.rb', line 405

def add_middleware(middleware, ...)
  middleware_chain.add(middleware, ...)
end

#validate!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



409
410
411
412
413
414
415
416
# File 'lib/activejob/temporal/configuration.rb', line 409

def validate!
  return if validation_level == :none

  validator = build_validator
  return if validator.valid?

  handle_validation_errors(validator.errors)
end