Skip to content
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

[improve][client] Add newMessage with schema and transactions #23942

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

omarkj
Copy link
Contributor

@omarkj omarkj commented Feb 6, 2025

Pulsar Client allows callers to create messages with a schema or a transaction, but not both.

This commit adds a new method in the producer that allows callers to create a message with both a schema and transaction.

  • 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

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions github-actions bot added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Feb 6, 2025
Comment on lines +147 to +148
<V> TypedMessageBuilder<V> newMessage(Schema<V> schema,
Transaction txn);
Copy link
Contributor

Choose a reason for hiding this comment

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

This change adds a new public API, which requires a PIP. https://github.com/apache/pulsar/tree/master/pip#when-is-a-pip-required

BTW, for this implementation PR, you should add a test to ensure it works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a test suite for the producer? I was unable to find one to add to.

Copy link
Contributor

Choose a reason for hiding this comment

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

No. Instead, I think you should add a test to TransactionTest to show which case this new API should be used. e.g.

// producer is a Producer<String> while value is a String rather than byte[]
producer.newMessage(schema, txn).value(value).send();

@dao-jun
Copy link
Member

dao-jun commented Feb 7, 2025

@omarkj
Copy link
Contributor Author

omarkj commented Feb 7, 2025

PIP PR filed here: #23950, will follow those guidelines by emailing out to the thread soon, etc.

Pulsar Client allows callers to create messages with a schema or a transaction, but
not both. This commit adds a new method in the producer that allows callers to create
a message with both a schema and transaction.
@omarkj omarkj force-pushed the producer-new-message-schema-txn branch from d77ad02 to 59dd60a Compare February 10, 2025 19:16
@omarkj omarkj requested a review from BewareMyPower February 10, 2025 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants