Skip to content

feat(cpp): add functions related to offset, tests related to consumer groups#3559

Open
slbotbm wants to merge 11 commits into
apache:masterfrom
slbotbm:cpp-more-more-function
Open

feat(cpp): add functions related to offset, tests related to consumer groups#3559
slbotbm wants to merge 11 commits into
apache:masterfrom
slbotbm:cpp-more-more-function

Conversation

@slbotbm

@slbotbm slbotbm commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Closes #
Relates to #2100

Rationale

Additions of more functions and tests in the cpp sdk.

What changed?

  • decouples delete_connection from logout_user function.
  • adds logout_user, update_stream, store_consume_offset, get_consumer_offset, delete_consumer_offset, and flush_unsaved_buffer functions
  • adds tests for join_consumer_group and leave_consumer_group, which were missing previously. Added cleanup related to consumer groups as well.
  • All conversion code was moved into type_conversions.rs for ease of finding.
  • Also added consumer and producer types for high-level api, and commented-out method signatures for the rest of the remaining functions in lib.rs

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

If AI tools were used, please answer:

  1. Which tools? codex
  2. Scope of usage? code generation, researcg
  3. How did you verify the generated code works correctly? tested it, read through it
  4. Can you explain every line of the code if asked? yes

@github-actions

Copy link
Copy Markdown

Thanks for the PR. It is labeled S-waiting-on-review and queued for review.

Slash commands (own line, regular comment) move it around the queue:

  • /ready - back to S-waiting-on-review after addressing feedback
  • /author - flip to S-waiting-on-author while you finish changes
  • /request-review @user-or-team - request a reviewer

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Jun 24, 2026
Comment thread foreign/cpp/build.rs Outdated
println!("cargo:rerun-if-changed=src/client.rs");
println!("cargo:rerun-if-changed=src/consumer_group.rs");
println!("cargo:rerun-if-changed=src/consumer.rs");
println!("cargo:rerun-if-changed=src/producer.rs");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rerun-if-changed list is out of sync with this PR. lines 29-30 still point at src/stream.rs and src/topic.rs, both deleted here. once a build script emits any rerun-if-changed, cargo stops watching the whole package and only watches the listed paths - and a listed path that no longer exists is treated as always-dirty, so the script reruns on every cargo build and recompiles the cxx C++ bridge each time. confirmed locally: with a missing listed path the build script ran on 3 of 3 no-op builds, vs 1 of 3 when every path exists. fix: drop the stream.rs and topic.rs lines. separately the new src/type_conversion.rs isn't listed - not a correctness issue (cxx codegen only reads lib.rs, and the crate recompiles on any .rs change regardless) but worth adding for consistency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread foreign/cpp/src/client.rs
})
}

pub fn store_consumer_offset(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

store_consumer_offset, get_consumer_offset and delete_consumer_offset repeat the same two blocks verbatim - the consumer_kind match ("consumer" -> Consumer::new, "consumer_group" -> Consumer::group, else error) and the partition_id == ANY_PARTITION_ID -> Option mapping (a 4th copy of the one in poll_messages). worth pulling out a small resolve_consumer(kind, id) helper plus an opt_partition(u32) helper so the kind strings and the sentinel live in one place. drops ~30 lines and removes the risk of the three copies drifting apart.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Jun 29, 2026
@slbotbm

slbotbm commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Jun 29, 2026
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.

2 participants