Class: Rdkafka::Producer
- Inherits:
-
Object
- Object
- Rdkafka::Producer
- Defined in:
- lib/fluent/plugin/out_rdkafka2.rb,
lib/fluent/plugin/out_rdkafka.rb
Instance Method Summary collapse
-
#close(timeout = nil) ⇒ Object
return false if producer is forcefully closed, otherwise return true.
Instance Method Details
#close(timeout = nil) ⇒ Object
return false if producer is forcefully closed, otherwise return true
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fluent/plugin/out_rdkafka2.rb', line 30 def close(timeout = nil) rdkafka_version = Rdkafka::VERSION || '0.0.0' # Rdkafka version >= 0.12.0 changed its internals if Gem::Version::create(rdkafka_version) >= Gem::Version.create('0.12.0') ObjectSpace.undefine_finalizer(self) return @client.close(timeout) end @closing = true # Wait for the polling thread to finish up # If the broker isn't alive, the thread doesn't exit if timeout thr = @polling_thread.join(timeout) return !!thr else @polling_thread.join return true end end |