Skip to content

Add streams XREADGROUP and XACK example. #1832

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

Merged
merged 6 commits into from
Jan 19, 2022
Merged

Conversation

simonprickett
Copy link
Contributor

Description

This adds a stream consumer group example that uses XREADGROUP and XACK.

Closes #1831


Checklist

  • [ y] Does npm test pass with this change (including linting)?
  • [ y] Is the new or changed code fully tested?
  • [ y] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2022

Codecov Report

Merging #1832 (d4767c9) into master (2ff7084) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1832   +/-   ##
=======================================
  Coverage   95.05%   95.05%           
=======================================
  Files         353      353           
  Lines        3314     3314           
  Branches      407      407           
=======================================
  Hits         3150     3150           
  Misses         81       81           
  Partials       83       83           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ff7084...d4767c9. Read the comment docs.

@@ -6,7 +6,6 @@ async function streamProducer() {
const client = createClient();

await client.connect();
await client.del('mystream');
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@leibale I removed the del because this makes this example work better with the consumer group one... if this deletes the stream it will delete any associated consumer groups too and then if they're running the consumer group example and it runs out of entries to process then they start the producer again it will blow away the stream rather than just continue to add new entries to it.

MKSTREAM: true
});
console.log('Created consumer group.');
} catch (e) {
Copy link
Contributor

@leibale leibale Jan 15, 2022

Choose a reason for hiding this comment

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

log the error?

@leibale leibale merged commit 41f6b00 into master Jan 19, 2022
@leibale leibale deleted the add-xreadgroup-example-#1831 branch January 19, 2022 18:36
florian-schunk pushed a commit to florian-schunk/node-redis that referenced this pull request Jun 18, 2025
* Removed stream delete command to allow consumer group example to work.

* Adds stream consumer group example.

* Adds stream consumer group example code.

* Update README.md

Co-authored-by: Leibale Eidelman <leibale1998@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add example for XREADGROUP
3 participants