Class: Dionysus::Producer::Genesis::Streamer

Inherits:
Object
  • Object
show all
Defined in:
lib/dionysus/producer/genesis/streamer.rb

Defined Under Namespace

Classes: BaseJob, StandardJob

Instance Method Summary collapse

Constructor Details

#initialize(job_class: Dionysus::Producer::Genesis::Streamer::StandardJob, config: Dionysus::Producer.configuration) ⇒ Streamer

Returns a new instance of Streamer.



7
8
9
10
11
# File 'lib/dionysus/producer/genesis/streamer.rb', line 7

def initialize(job_class: Dionysus::Producer::Genesis::Streamer::StandardJob,
  config: Dionysus::Producer.configuration)
  @job_class = job_class
  @config = config
end

Instance Method Details

#stream(topic, model_class, from, to, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/dionysus/producer/genesis/streamer.rb', line 13

def stream(topic, model_class, from, to, options = {})
  resources = fetch_resources(model_class, from, to, options)
  job_class.enqueue(
    resources,
    model_class,
    topic,
    number_of_days: options.fetch(:number_of_days, 1),
    batch_size: options.fetch(:batch_size, 1000)
  )
end