Class: Dionysus::Producer::Outbox::TombstonePublisher

Inherits:
Object
  • Object
show all
Defined in:
lib/dionysus/producer/outbox/tombstone_publisher.rb

Instance Method Summary collapse

Constructor Details

#initialize(config: Dionysus::Producer.configuration) ⇒ TombstonePublisher

Returns a new instance of TombstonePublisher.



10
11
12
# File 'lib/dionysus/producer/outbox/tombstone_publisher.rb', line 10

def initialize(config: Dionysus::Producer.configuration)
  @config = config
end

Instance Method Details

#tombstone(resource, responder, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/dionysus/producer/outbox/tombstone_publisher.rb', line 14

def tombstone(resource, responder, options = {})
  partition_key = options.fetch(:partition_key) do
    Dionysus::Producer::PartitionKey.new(resource, config: config).to_key(responder: responder)
  end
  key = options.fetch(:key) { Dionysus::Producer::Key.new(resource).to_key }

  responder.call(TOMBSTONE, partition_key: partition_key, key: key)
end