Skip to content

Conversation

@chickenchickenlove
Copy link
Contributor

@chickenchickenlove chickenchickenlove commented Dec 29, 2025

PR Description

this PR refactors TransactionManager#throwIfPendingState to use a typed TransactionOperation enum instead of a raw String.

###Background / Motivation
The previous String-based API relies on manually passing operation names, which can make it easier for naming to drift or become inconsistent over time. Using an enum makes the intent more explicit and keeps the operation naming centralized.

What’s changed

  • Added a TransactionOperation enum with a displayName (and toString() override) to preserve readable exception messages.
  • Updated relevant call sites (beginTransaction, prepareTransaction, sendOffsetsToTransaction, maybeAddPartition) to pass the corresponding enum value.
  • Updated throwIfPendingState to accept TransactionOperation instead of String.

Behavior / Compatibility

  • No behavioral change is intended. The exception message remains human-readable and consistent via TransactionOperation#toString().

Testing

No additional tests were added since this is a small refactor; existing tests should continue to cover the pending-transition behavior.

@github-actions github-actions bot added triage PRs from the community producer clients small Small PRs labels Dec 29, 2025
Copy link
Collaborator

@TaiJuWu TaiJuWu left a comment

Choose a reason for hiding this comment

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

LGTM.

@github-actions github-actions bot removed the triage PRs from the community label Jan 1, 2026
@chickenchickenlove
Copy link
Contributor Author

Hi, @chia7712 !
Sorry to bother you and thanks for your approving CI 🙇‍♂️
When you have time, could you take a look?
Thanks always!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants