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

feat: add the partitionKey to the messages #992

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

Conversation

benjamin99
Copy link

@benjamin99 benjamin99 commented Feb 28, 2023

Motivation

In my usage, I need to get the partition key of the messages, which is not currently supported in the pulsarctl.
The PR added the instruction to load partition key from the SingleMessageMetadata in the getIndividualMsgsFromBatch method, so the resulting messages would contain the corresponding partition keys.

Modifications

  • added the PartitionKey to the message model.
  • adjusted the getIndividualMsgsFromBatch method to load the partition key to the resulting messages.

Verifying this change

  • Make sure that the change passes the CI checks.

  • not sure the tests is required for the PR, since not seeing any message related tests in the current codebase (if I miss out anything, please let me know and I will complete the tests ASAP).

Documentation

Check the box below.

Need to update docs?

  • doc-required

  • no-need-doc

    not affecting any current behavior, so maybe no update is required?

  • doc

@github-actions
Copy link

@benjamin99:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions github-actions bot added doc-info-missing This pr needs to mark a document option in description and removed doc-info-missing This pr needs to mark a document option in description labels Feb 28, 2023
@github-actions
Copy link

@benjamin99:Thanks for providing doc info!

@github-actions github-actions bot added the no-need-doc This pr does not need any document label Feb 28, 2023
Payload []byte
Topic string
Properties map[string]string
PartitionKey string
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
PartitionKey string
PartitionKey *string

is it better?

Copy link
Author

Choose a reason for hiding this comment

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

I have considered both of the options, but overall I think it would be better to use string type since 1) it makes no sense to set the partition key to be the empty string for any pulsar message, and 2) it is more common to see the string as the property type instead of the string pointer.
Still I can make the change if you think it might be better to maintain the same type as the one defined in the SingleMessageMetadata.

Copy link
Author

@benjamin99 benjamin99 Mar 7, 2023

Choose a reason for hiding this comment

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

Hi @nodece sorry for bothering, but I just wanna know if there is there anything I can do to make further progress as regarding the PR?

@nodece
Copy link
Contributor

nodece commented Mar 8, 2023

@zymap Could you review this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-need-doc This pr does not need any document
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants