Class: DbBlaster::SnsPublisher
Overview
Publishes records to AWS SNS
Instance Attribute Summary
#batch_start_time, #records, #source_table
Instance Method Summary
collapse
#initialize, publish
Instance Method Details
#message_attributes ⇒ Object
29
30
31
32
|
# File 'lib/db_blaster/sns_publisher.rb', line 29
def message_attributes
(DbBlaster.configuration. || {})
.merge('source_table' => { data_type: 'String', string_value: source_table.name })
end
|
#publish ⇒ Object
10
11
12
13
|
# File 'lib/db_blaster/sns_publisher.rb', line 10
def publish
topic.publish(message_attributes: message_attributes,
message: records.to_json)
end
|
#resource ⇒ Object
19
20
21
|
# File 'lib/db_blaster/sns_publisher.rb', line 19
def resource
@resource ||= Aws::SNS::Resource.new(client: client)
end
|
#topic ⇒ Object
15
16
17
|
# File 'lib/db_blaster/sns_publisher.rb', line 15
def topic
resource.topic(DbBlaster.configuration.sns_topic)
end
|