Class: Dionysus::Producer::BaseResponder

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

Overview

Based on the responder concept from Karafka 1.4

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseResponder

Returns a new instance of BaseResponder.



20
21
22
# File 'lib/dionysus/producer/base_responder.rb', line 20

def initialize
  @messages_buffer = Hash.new { |h, k| h[k] = [] }
end

Class Attribute Details

.topicsObject

Returns the value of attribute topics.



6
7
8
# File 'lib/dionysus/producer/base_responder.rb', line 6

def topics
  @topics
end

Instance Attribute Details

#messages_bufferObject (readonly)

Returns the value of attribute messages_buffer.



18
19
20
# File 'lib/dionysus/producer/base_responder.rb', line 18

def messages_buffer
  @messages_buffer
end

Class Method Details

.call(*data) ⇒ Object



13
14
15
# File 'lib/dionysus/producer/base_responder.rb', line 13

def call(*data)
  new.call(*data)
end

.topic(topic_name) ⇒ Object



8
9
10
11
# File 'lib/dionysus/producer/base_responder.rb', line 8

def topic(topic_name)
  self.topics ||= {}
  self.topics[topic_name] = topic_name.to_s
end

Instance Method Details

#call(*data) ⇒ Object



24
25
26
27
# File 'lib/dionysus/producer/base_responder.rb', line 24

def call(*data)
  respond(*data)
  deliver
end