- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13
 
Add io event queue fd #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for IO event notifications on Kafka consumer queues to enable event-driven consumption patterns. It exposes librdkafka's rd_kafka_queue_io_event_enable functionality through new Ruby APIs.
Key changes:
- Added consumer and main queue pointer access methods with proper cleanup
 - Implemented IO event enabling functionality with file descriptor notifications
 - Added comprehensive test coverage for the new queue APIs
 
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description | 
|---|---|
| lib/rdkafka/consumer.rb | Adds queue pointer methods and IO event enabling with proper resource cleanup | 
| lib/rdkafka/bindings.rb | Exposes new librdkafka queue functions for consumer queue and IO events | 
| spec/lib/rdkafka/consumer_spec.rb | Tests for consumer queue methods and IO event functionality | 
| spec/lib/rdkafka/bindings/queue_spec.rb | Comprehensive integration tests for queue bindings and event-driven patterns | 
| CHANGELOG.md | Documents the new queue IO event notification feature | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| attach_function :rd_kafka_queue_get_background, [:pointer], :pointer | ||
| attach_function :rd_kafka_conf_set_background_event_cb, [:pointer, :pointer], :void | ||
| attach_function :rd_kafka_queue_destroy, [:pointer], :void | ||
| attach_function :rd_kafka_queue_get_consumer, [:pointer], :pointer | 
    
      
    
      Copilot
AI
    
    
    
      Oct 12, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing attachment for rd_kafka_queue_get_main function which is used in the consumer implementation but not declared in bindings.
| attach_function :rd_kafka_queue_get_consumer, [:pointer], :pointer | |
| attach_function :rd_kafka_queue_get_consumer, [:pointer], :pointer | |
| attach_function :rd_kafka_queue_get_main, [:pointer], :pointer | 
| @@ -0,0 +1,284 @@ | |||
| # frozen_string_literal: true | |||
| 
               | 
          |||
| require 'spec_helper' | |||
    
      
    
      Copilot
AI
    
    
    
      Oct 12, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing require 'fcntl' at the top of the spec file, which is needed for the Fcntl::F_SETFL and Fcntl::O_NONBLOCK constants used throughout the tests.
| require 'spec_helper' | |
| require 'spec_helper' | |
| require 'fcntl' | 
This PR adds FD IO events for consumer and main queues.