-
Notifications
You must be signed in to change notification settings - Fork 68
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: Subscription get message by id json output #1704
Merged
zymap
merged 2 commits into
streamnative:master
from
Nikolajls:nikolajls/get_message_by_id_output_json
Jan 15, 2025
Merged
feat: Subscription get message by id json output #1704
zymap
merged 2 commits into
streamnative:master
from
Nikolajls:nikolajls/get_message_by_id_output_json
Jan 15, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Nikolajls:Thanks for your contribution. For this PR, do we need to update docs? |
github-actions
bot
added
the
doc-info-missing
This pr needs to mark a document option in description
label
Jan 12, 2025
Nikolajls
changed the title
fea:t: Subscription get message by id json output
feat: Subscription get message by id json output
Jan 12, 2025
@Nikolajls:Thanks for providing doc info! |
github-actions
bot
added
no-need-doc
This pr does not need any document
and removed
doc-info-missing
This pr needs to mark a document option in description
labels
Jan 13, 2025
zymap
approved these changes
Jan 15, 2025
zymap
pushed a commit
that referenced
this pull request
Jan 15, 2025
* Add an possible JSON output of the get message by id. * rename readMessage struct to not export , modify string output (cherry picked from commit 6c42e3a)
zymap
pushed a commit
that referenced
this pull request
Jan 15, 2025
* Add an possible JSON output of the get message by id. * rename readMessage struct to not export , modify string output (cherry picked from commit 6c42e3a)
zymap
pushed a commit
that referenced
this pull request
Jan 15, 2025
* Add an possible JSON output of the get message by id. * rename readMessage struct to not export , modify string output (cherry picked from commit 6c42e3a)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-picked/branch-3.0
cherry-picked/branch-3.3
cherry-picked/branch-4.0
no-need-doc
This pr does not need any document
release/3.0
release/3.3
release/4.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change is to add a possiblity of JSON output from the
subscription.get_message_by_id
command.Motivation
In our organization we suggested our teams to utilize Pulsarctl when investigating or debugging Pulsar topics, subscriotions.
Almost all of our messages are in the end json serialized data, but we have also had a few people utilize only strings as the data within the the byte[] sent to pulsar.
When an issue occurs in a consuming system, where e.g a message is received correctly, but fails to be proccesed in the system it always a guarentee that the consuming code allows the team to investigate the message data. That all depends on how they´ve set up their system.
However we advise to use Pulsarctl as a means to be able to view their messages, maybe copy the message content out to examine it further.
But currently the output of the command is a funky raw text outputted along with a hex.Dump of the []byte. looking like this:
In my example the message is very small, but lets say the message had like 50 fields with properties, maybe nested.
The column to the right becomes very big and hard to copy value from without doing some terminal magic and converting.
With this the change a JSON representation of the message - alongside the payload is outputted:
We can then copy the entire result (or pipe it to something else), unescape the escaped json from
PayloadAsString
property and have the JSON content available"I know that messages can also be something entirely else like a file read from disk to a byte array - like a jpg sent as a byte[].
This with text output looks like this:
And with json output looks like this:
Modifications
Describe the modifications you've done.
Add
readMessage
structAdd usage of WithObject output as wel.
Verifying this change
I have another PR #1699 for the same command fixing a typo.
And this issue #1703 for verifying needs some input.
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
Documentation
Check the box below.
no-need-doc