Class: Alephant::Publisher::Queue::Writer

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/alephant/publisher/queue/writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, message) ⇒ Writer

Returns a new instance of Writer.



18
19
20
21
# File 'lib/alephant/publisher/queue/writer.rb', line 18

def initialize(config, message)
  @config   = config
  @message  = message
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



16
17
18
# File 'lib/alephant/publisher/queue/writer.rb', line 16

def config
  @config
end

#messageObject (readonly)

Returns the value of attribute message.



16
17
18
# File 'lib/alephant/publisher/queue/writer.rb', line 16

def message
  @message
end

#parserObject (readonly)

Returns the value of attribute parser.



16
17
18
# File 'lib/alephant/publisher/queue/writer.rb', line 16

def parser
  @parser
end

#storageObject (readonly)

Returns the value of attribute storage.



16
17
18
# File 'lib/alephant/publisher/queue/writer.rb', line 16

def storage
  @storage
end

Instance Method Details

#rendererObject



23
24
25
# File 'lib/alephant/publisher/queue/writer.rb', line 23

def renderer
  @renderer ||= Alephant::Renderer.create(config, data)
end

#run!Object



40
41
42
43
44
45
46
47
# File 'lib/alephant/publisher/queue/writer.rb', line 40

def run!
  if component_records_write_successful?
    seq_for(config[:renderer_id]).validate(message) do
      # block needed in sequencer. Need to make optional with `block.given?`
      # https://github.com/BBC-News/alephant-sequencer/blob/master/lib/alephant/sequencer/sequencer.rb#L41
    end
  end
end