Class: DbBlaster::BasePublisher

Inherits:
Object
  • Object
show all
Defined in:
lib/db_blaster/base_publisher.rb

Overview

Base class for publishing

Direct Known Subclasses

S3Publisher, SnsPublisher

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_table, records, batch_start_time) ⇒ BasePublisher

Returns a new instance of BasePublisher.



9
10
11
12
13
# File 'lib/db_blaster/base_publisher.rb', line 9

def initialize(source_table, records, batch_start_time)
  @source_table = source_table
  @records = records
  @batch_start_time = batch_start_time
end

Instance Attribute Details

#batch_start_timeObject (readonly)

Returns the value of attribute batch_start_time.



7
8
9
# File 'lib/db_blaster/base_publisher.rb', line 7

def batch_start_time
  @batch_start_time
end

#recordsObject (readonly)

Returns the value of attribute records.



7
8
9
# File 'lib/db_blaster/base_publisher.rb', line 7

def records
  @records
end

#source_tableObject (readonly)

Returns the value of attribute source_table.



7
8
9
# File 'lib/db_blaster/base_publisher.rb', line 7

def source_table
  @source_table
end

Class Method Details

.publish(source_table:, records:, batch_start_time:) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/db_blaster/base_publisher.rb', line 15

def self.publish(source_table:, records:, batch_start_time:)
  publisher_class =
    if DbBlaster.configuration.sns_topic
      SnsPublisher
    else
      S3Publisher
    end
  publisher_class.new(source_table, records, batch_start_time).publish
end

Instance Method Details

#publishObject

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/db_blaster/base_publisher.rb', line 25

def publish
  raise NotImplementedError
end