Class: Kafka::Poller
- Inherits:
-
Thread
- Object
- Thread
- Kafka::Poller
- Defined in:
- lib/kafka/poller.rb
Overview
Niceties around a Thread to call Client#poll at a regular interval. This is required in the Producer and optional in the Consumer when poll_set_consumer is not used.
Instance Method Summary collapse
-
#initialize(client) ⇒ Poller
constructor
A new instance of Poller.
- #stop ⇒ Object
Constructor Details
#initialize(client) ⇒ Poller
Returns a new instance of Poller.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/kafka/poller.rb', line 10 def initialize(client) @client = client @run = true self.abort_on_exception = true super do while @run @client.poll end end end |
Instance Method Details
#stop ⇒ Object
23 24 25 26 |
# File 'lib/kafka/poller.rb', line 23 def stop @run = false join end |