Method: Rdkafka::Consumer#poll
- Defined in:
- lib/rdkafka/consumer.rb
permalink #poll(timeout_ms) ⇒ Message?
Poll for the next message on one of the subscribed topics
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 |
# File 'lib/rdkafka/consumer.rb', line 537 def poll(timeout_ms) closed_consumer_check(__method__) = @native_kafka.with_inner do |inner| Rdkafka::Bindings.rd_kafka_consumer_poll(inner, timeout_ms) end if .null? nil else # Create struct wrapper = Rdkafka::Bindings::Message.new() # Raise error if needed if [:err] != 0 raise Rdkafka::RdkafkaError.new([:err]) end # Create a message to pass out Rdkafka::Consumer::Message.new() end ensure # Clean up rdkafka message if there is one if && !.null? Rdkafka::Bindings.() end end |