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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Build a configuration with safe defaults.



19
20
21
22
23
24
25
26
# File 'lib/cdc/solid_queue/configuration.rb', line 19

def initialize
  @processor_job = nil
  @queue = 'cdc'
  @preserve_order = true
  @ordering_key = :identity
  @postgresql = {}
  @checkpoint = Checkpoint.new
end

Instance Attribute Details

#checkpointObject

Returns the value of attribute checkpoint.



16
17
18
# File 'lib/cdc/solid_queue/configuration.rb', line 16

def checkpoint
  @checkpoint
end

#ordering_keyObject

Returns the value of attribute ordering_key.



16
17
18
# File 'lib/cdc/solid_queue/configuration.rb', line 16

def ordering_key
  @ordering_key
end

#postgresqlObject

Returns the value of attribute postgresql.



16
17
18
# File 'lib/cdc/solid_queue/configuration.rb', line 16

def postgresql
  @postgresql
end

#preserve_orderObject

Returns the value of attribute preserve_order.



16
17
18
# File 'lib/cdc/solid_queue/configuration.rb', line 16

def preserve_order
  @preserve_order
end

#processor_jobObject

Returns the value of attribute processor_job.



16
17
18
# File 'lib/cdc/solid_queue/configuration.rb', line 16

def processor_job
  @processor_job
end

#queueObject

Returns the value of attribute queue.



16
17
18
# File 'lib/cdc/solid_queue/configuration.rb', line 16

def queue
  @queue
end

Instance Method Details

#sourceSymbol

Return a normalized source name.

Returns:

  • (Symbol)


47
48
49
50
# File 'lib/cdc/solid_queue/configuration.rb', line 47

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

#validate!true

Validate this configuration.

rubocop:disable Naming/PredicateMethod

Returns:

  • (true)

Raises:



34
35
36
37
38
39
40
41
# File 'lib/cdc/solid_queue/configuration.rb', line 34

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