Class: Mammoth::ReplicationConsumer
- Inherits:
-
Object
- Object
- Mammoth::ReplicationConsumer
- Defined in:
- lib/mammoth/replication_consumer.rb
Overview
Consumes normalized CDC work from an injected source.
ReplicationConsumer is intentionally upstream-agnostic. It does not know which upstream system produced the work. Its only job is to consume CDC Ecosystem work, flatten CDC transaction envelopes, and yield individual change events to the delivery pipeline.
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(source: nil) ⇒ ReplicationConsumer
constructor
A new instance of ReplicationConsumer.
-
#start {|event| ... } ⇒ Integer
Consume normalized CDC work from the configured source.
Constructor Details
#initialize(source: nil) ⇒ ReplicationConsumer
Returns a new instance of ReplicationConsumer.
14 15 16 |
# File 'lib/mammoth/replication_consumer.rb', line 14 def initialize(source: nil) @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
11 12 13 |
# File 'lib/mammoth/replication_consumer.rb', line 11 def source @source end |
Instance Method Details
#start {|event| ... } ⇒ Integer
Consume normalized CDC work from the configured source.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mammoth/replication_consumer.rb', line 22 def start return enum_for(:start) unless block_given? count = 0 each_event do |event| yield event count += 1 end count end |