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

fixed + slightly enhanced the basic example in jetstream package #1340

Merged
merged 2 commits into from
Jul 19, 2023

Conversation

pwntr
Copy link
Contributor

@pwntr pwntr commented Jul 5, 2023

When trying to get started with jetstream, I couldn't compile the basic example that was given in the README.md. One of the variables was never read (var msg jetstream.Msg), one check for a bool was not against a bool (if msgs.Error() {), cons is actually not the consumer but c is (it, _ := cons.Messages()), and a few more things (see new code).

I also made it clear in the console output which receiving type was used to get the particular message (fetch vs. callback vs. iterator).

This now compiles fine, and the crude loop at the end also waits for all test messages to be received as well. Dirty (like omitting all checks for err), but it should be enough to grasp the basic concepts.

pwntr added 2 commits July 5, 2023 16:06
…am package README.md, so that it compiles and completes with all messages arriving.
@piotrpio piotrpio self-requested a review July 7, 2023 12:33
Copy link
Collaborator

@piotrpio piotrpio left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

You have some valid points, although I do not think this should really be used as a standalone example, because it is mixing several concepts that don't really work together well. A goad of Basic usage was more to showcase various ways of interacting with the consumer.

That being said, better to have an example which works, so LGTM :)

@piotrpio piotrpio merged commit 83e1310 into nats-io:main Jul 19, 2023
1 check passed
@piotrpio piotrpio mentioned this pull request Jul 20, 2023
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.

None yet

2 participants