Class: Kafka::AsyncProducer::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/kafka/async_producer.rb

Instance Method Summary collapse

Constructor Details

#initialize(interval:, queue:) ⇒ Timer

Returns a new instance of Timer.


137
138
139
140
# File 'lib/kafka/async_producer.rb', line 137

def initialize(interval:, queue:)
  @queue = queue
  @interval = interval
end

Instance Method Details

#runObject


142
143
144
145
146
147
# File 'lib/kafka/async_producer.rb', line 142

def run
  loop do
    sleep(@interval)
    @queue << [:deliver_messages, nil]
  end
end