Skip to content

feat(cpp): let poll and offset calls take a typed consumer - #3995

Open
ethanlin01x wants to merge 7 commits into
apache:masterfrom
ethanlin01x:feat/cpp-typed-consumer
Open

feat(cpp): let poll and offset calls take a typed consumer#3995
ethanlin01x wants to merge 7 commits into
apache:masterfrom
ethanlin01x:feat/cpp-typed-consumer

Conversation

@ethanlin01x

@ethanlin01x ethanlin01x commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Relates to #3876

Rationale

The C++ SDK already let the caller name a consumer, but as a kind string paired with an identifier. Nothing checked that pair until it reached Rust, and the "let the server pick the partition" sentinel had no name at all.

What changed?

poll_messages and the three consumer-offset calls took consumer_kind: String, consumer_id: Identifier. A typo such as "consumer_grp" compiled fine and failed at runtime, and ConsumerKind::ConsumerGroup was reachable only by spelling the kind correctly.

They now take a single Consumer carrying a ConsumerKind enum, so the kind is checked where the call is written. iggy::Consumer::Single(id) and iggy::Consumer::Group(id) build it from either a name or a number, mirroring how TopicOption builds its entries. iggy::kAnyPartitionId gives the u32::MAX partition sentinel a name and documents what each call does with it: a group poll reads one of the partitions assigned to the polling member, a regular poll and get_consumer_offset read partition 0, and the two offset writes reject it.

The bridge already used the name Consumer for the placeholder wrapping the high-level consumer, so that one is renamed IggyConsumer, matching the Rust SDK.

Breaking change:

the four calls replace their consumer_kind and consumer_id arguments with a single consumer.

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

If AI tools were used, please answer:

  1. Which tools? Claude code
  2. Scope of usage? Analysis and implementation
  3. How did you verify the generated code works correctly? Local run
  4. Can you explain every line of the code if asked? Yes.

Frees the name for the consumer a poll names, matching the Rust SDK.
The kind was a string, so a bad one only failed once it reached Rust.
Building the bridge struct by hand leaves the kind unset and the partition
sentinel unnamed.
The kind is now checked where the call is written.

BREAKING CHANGE: poll_messages, store_consumer_offset, get_consumer_offset and
delete_consumer_offset replace their consumer_kind and consumer_id arguments
with a single consumer.
Two names read the whole partition, one shared name does not, and a group
member reads its assignment rather than partition 0.
Clears the TODO left for them, now that consumer groups exist.
@ethanlin01x
ethanlin01x force-pushed the feat/cpp-typed-consumer branch from 9538c7a to f7441df Compare August 30, 2026 08:26
@ethanlin01x ethanlin01x changed the title Feat/cpp typed consumer feat(cpp): let poll and offset calls take a typed consumer Aug 30, 2026
@ethanlin01x
ethanlin01x marked this pull request as ready for review August 30, 2026 08:28
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Aug 30, 2026
@ethanlin01x

Copy link
Copy Markdown
Contributor Author

/request-review @hubcio @slbotbm

@github-actions
github-actions Bot requested review from hubcio and slbotbm August 30, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant