-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Provide a way to customize a transactionIdSuffix #2852
Comments
This makes sense, although you can't reset it if there is still a producer with that prefix; the reset would have to eject the existing producer from the cache. A PR would certainly be welcome; thanks! |
If all transactionId are in use, Is it reasonable to implement a transaction connection pool? |
I don't think it's feasible because a transaction is a shared resource among many instances rather than a cross-one, so we can't suggest which transactionId is being used. In my opinion, the default strategy could be a round-robin approach. When we reach the limit, the counter resets. After each |
This comment was marked as outdated.
This comment was marked as outdated.
Probably the simplest solution would be a new property When a producer is not returned to the cache (either because it was fenced, or because the When a producer is requested and there are no cached producers, and there are no "available" suffixes, we throw a The user can then use a |
Hi, @stillya @garyrussell , If you don't mind, may i pick it up? |
Sure; thanks! |
add properties `maxCache` at `DefaultKafkaProducerFactory`, setting `maxCache` greater than zero can reuse `transactional.id`. Resolves spring-projects#2852
add properties `maxCache` at `DefaultKafkaProducerFactory`, setting `maxCache` greater than zero can reuse `transactional.id`. Resolves spring-projects#2852
Introducing a new interface for generating transactionIdSuffix with a default increment implementation. Introducing a new interface for return the current transactionIdSuffix. Resolves spring-projects#2852
Hi, @Wzy19930507 and @sobychacko. |
Fixes: #2852 * Provide a way to customize the transactionIdSuffix by providing a new strategy API - `TransactionIdSuffixStrategy` * PR adds a default implementation for this new API * Related changes in classes that deal with transactions
Expected Behavior
Provide strategy to customize a
transactionIdSuffix
.Current Behavior
Currently, spring-kafka use AtomicInteger for transactionIdSuffix.
Context
In my environment, I work with restricted
transactionId
within a specific range(e.g. topic-{1-5}).Currently, spring-kafka use AtomicInteger for
transactionIdSuffix
, it would be beneficial to have the flexibility to implement a custom strategy fortransactionIdSuffix
.This could involve actions such as resetting the counter after reaching a limit or a storage for managing
transactionsIds
.I'm happy to contribute a PR once I know what your opinion on this feature is.
The text was updated successfully, but these errors were encountered: