Class: CDC::SolidQueue::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/cdc/solid_queue/configuration.rb

Overview

Runtime configuration for PostgreSQL CDC ingestion into Solid Queue.

The configuration object is intentionally small in the first release. It describes the target job class, Solid Queue queue name, ordering behavior, and PostgreSQL replication settings.

Constant Summary collapse

SUPPORTED_SOURCE =

The only CDC source supported by the initial implementation.

:postgresql
ORDERING_KEYS =

Supported ordering scopes for serialized CDC events.

%i[identity primary_key relation transaction global none].freeze
DOWNSTREAM_RUNTIMES =

Supported downstream execution runtimes for processor jobs.

%i[concurrent parallel direct].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Build a configuration with safe defaults.



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cdc/solid_queue/configuration.rb', line 22

def initialize
  @processor_job = nil
  @queue = 'cdc'
  @preserve_order = true
  @ordering_key = :identity
  @postgresql = {}
  @checkpoint = Checkpoint.new
  @downstream_processor = nil
  @downstream_runtime = :concurrent
  @downstream_options = {}
  @batch_size = 1
end

Instance Attribute Details

#batch_sizeObject

Returns the value of attribute batch_size.



18
19
20
# File 'lib/cdc/solid_queue/configuration.rb', line 18

def batch_size
  @batch_size
end

#checkpointObject

Returns the value of attribute checkpoint.



18
19
20
# File 'lib/cdc/solid_queue/configuration.rb', line 18

def checkpoint
  @checkpoint
end

#downstream_optionsObject

Returns the value of attribute downstream_options.



18
19
20
# File 'lib/cdc/solid_queue/configuration.rb', line 18

def downstream_options
  @downstream_options
end

#downstream_processorObject

Returns the value of attribute downstream_processor.



18
19
20
# File 'lib/cdc/solid_queue/configuration.rb', line 18

def downstream_processor
  @downstream_processor
end

#downstream_runtimeObject

Returns the value of attribute downstream_runtime.



18
19
20
# File 'lib/cdc/solid_queue/configuration.rb', line 18

def downstream_runtime
  @downstream_runtime
end

#ordering_keyObject

Returns the value of attribute ordering_key.



18
19
20
# File 'lib/cdc/solid_queue/configuration.rb', line 18

def ordering_key
  @ordering_key
end

#postgresqlObject

Returns the value of attribute postgresql.



18
19
20
# File 'lib/cdc/solid_queue/configuration.rb', line 18

def postgresql
  @postgresql
end

#preserve_orderObject

Returns the value of attribute preserve_order.



18
19
20
# File 'lib/cdc/solid_queue/configuration.rb', line 18

def preserve_order
  @preserve_order
end

#processor_jobObject

Returns the value of attribute processor_job.



18
19
20
# File 'lib/cdc/solid_queue/configuration.rb', line 18

def processor_job
  @processor_job
end

#queueObject

Returns the value of attribute queue.



18
19
20
# File 'lib/cdc/solid_queue/configuration.rb', line 18

def queue
  @queue
end

Instance Method Details

#sourceSymbol

Return a normalized source name.

Returns:

  • (Symbol)


56
57
58
59
# File 'lib/cdc/solid_queue/configuration.rb', line 56

def source
  configured = @postgresql.fetch(:source, SUPPORTED_SOURCE)
  configured.to_sym
end

#validate!true

Validate this configuration.

rubocop:disable Naming/PredicateMethod

Returns:

  • (true)

Raises:



41
42
43
44
45
46
47
48
49
50
# File 'lib/cdc/solid_queue/configuration.rb', line 41

def validate!
  validate_processor_job!
  validate_queue!
  validate_ordering_key!
  validate_postgresql!
  validate_checkpoint!
  validate_downstream!
  validate_batch_size!
  true
end