Class: Dionysus::Producer::Outbox
- Inherits:
-
Object
- Object
- Dionysus::Producer::Outbox
show all
- Defined in:
- lib/dionysus/producer/outbox.rb
Defined Under Namespace
Modules: ActiveRecordPublishable, Model
Classes: DatadogLatencyReporter, DatadogLatencyReporterJob, DatadogLatencyReporterScheduler, DatadogTracer, DuplicatesFilter, EventName, HealthCheck, LatencyTracker, Producer, Publishable, Publisher, RecordsProcessor, Runner, TombstonePublisher
Instance Method Summary
collapse
Constructor Details
#initialize(outbox_model, config:) ⇒ Outbox
Returns a new instance of Outbox.
7
8
9
10
|
# File 'lib/dionysus/producer/outbox.rb', line 7
def initialize(outbox_model, config:)
@outbox_model = outbox_model
@config = config
end
|
Instance Method Details
#insert_created(record) ⇒ Object
12
13
14
|
# File 'lib/dionysus/producer/outbox.rb', line 12
def insert_created(record)
insert(Publishable.new(record), :created)
end
|
#insert_destroyed(record) ⇒ Object
28
29
30
31
32
|
# File 'lib/dionysus/producer/outbox.rb', line 28
def insert_destroyed(record)
publishable = Publishable.new(record)
insert(publishable, :destroyed)
end
|
#insert_updated(record) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/dionysus/producer/outbox.rb', line 16
def insert_updated(record)
publishable = Publishable.new(record)
return [] unless publishable.previously_changed?
if publishable.respond_to?(config.soft_delete_column)
event_type = event_type_for_update_of_soft_deletable_record(publishable) or return []
insert(publishable, event_type)
else
insert(publishable, :updated)
end
end
|