Skip to content

[improve][txn] Move TransactionCoordinatorClient to public API - #26646

Merged
lhotari merged 7 commits into
apache:masterfrom
TomaszGaweda:move-TransactionCoordinatorClient-to-public-api
Sep 19, 2026
Merged

lhotari merged 7 commits into
apache:masterfrom
TomaszGaweda:move-TransactionCoordinatorClient-to-public-api

Conversation

@TomaszGaweda

Copy link
Copy Markdown
Contributor

Related to: #26452

This PR removes of @PrivateApi annotations from TransactionCoordinatorClient and with moves TransactionCoordinatorClient to a public API for PulsarClient.

Fixes #26452

Motivation

One thing that is missing is our ability for commit or abort a transaction by ID itself. It is super useful (mandatory for exactly-once) in streaming engines, like Hazelcast Jet or Apache Flink. We (Hazelcast) track snapshot transaction IDs (including TxnID), in case of failures we want to be able to reliably commit or abort transactions in progress. Right now it's impossible to do officially.

I can do following:

		PulsarClientImpl impl = (PulsarClientImpl) client;
        TransactionCoordinatorClient tcClient = impl.getTcClient();
        if (commit) {
            try {
                tcClient.commit(transactionId.txId);
            } catch (TransactionCoordinatorClientException e) {
                throw new RuntimeException(e);
            }
        } else {
            try {
                tcClient.abort(transactionId.txId);
            } catch (TransactionCoordinatorClientException e) {
                throw new RuntimeException(e);
            }
        }

and Flink was also doing this.

However, it relies on casting to implementation classes classes and using interface marked as PrivateApi.

Modifications

  • Removal of PrivateApi annotations
  • Adding neccesary method in PulsarClient to access TransactionCoordinatorClient

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

@lhotari lhotari left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Yes, this makes sense. Let's include this change in Pulsar 5.0.0 so that it becomes available. Pulsar 5.x client is backwards compatible with older broker versions.

@lhotari lhotari added this to the 5.0.0 milestone Sep 18, 2026
@TomaszGaweda
TomaszGaweda force-pushed the move-TransactionCoordinatorClient-to-public-api branch from c98de95 to 9cdbaec Compare September 19, 2026 08:41
…t-to-public-api' into move-TransactionCoordinatorClient-to-public-api
@lhotari
lhotari merged commit 645a6a5 into apache:master Sep 19, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants