Skip to content

Conversation

@mensfeld
Copy link
Member

This PR adds FD IO events for consumer and main queues.

@mensfeld mensfeld requested a review from Copilot October 12, 2025 09:41
@mensfeld mensfeld self-assigned this Oct 12, 2025
Copy link

Copilot AI left a 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
Copy link

Copilot AI Oct 12, 2025

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,284 @@
# frozen_string_literal: true

require 'spec_helper'
Copy link

Copilot AI Oct 12, 2025

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.

Suggested change
require 'spec_helper'
require 'spec_helper'
require 'fcntl'

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants