question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set

See original GitHub issue

I have this configuration that throws the above error when I start the server

const opts = consumerOpts()
    opts.durable(this.queueGroupName))
    opts.manualAck()
    opts.ackExplicit()
    let sub = await this.client.jetstream().pullSubscribe(this.subject, opts)

What am I doing wrong? This code is derived from this documentation

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
aricartcommented, Feb 28, 2022

setInterval(() => { sub.pull({ batch: 10, no_wait: true }) }, 1000)

That code is a server spam because every second you are asking for 10 messages, and for the request to fail immediately if there are no messages - instead, specify an expires that is possibly 2000, and an interval that is slightly smaller - this will keep the pull open and if messages arrive before the pull expires, they will be fed to you then.

This requires more coordination - the library will help you coordinate this type of action soon - as we are actively looking into making the consumers pull by default (to simplify importing streams) and automatically have them re-pull every so oftne.

1reaction
aricartcommented, Feb 28, 2022

@Nahasean94

(async () => { for await(const m of sub) { console.log(“\n”, m.subject); m.ack(); } })();

The IDE is right. While you don’t need to await it, you should probably handle what happens - so in the case above, if the subscription were to throw an error or was to end unexpectedly something you wouldn’t know about it - the reason for the linter warning is more about an error - if the function threw an error in the loop, that would kill your node process.

typically you:

(async () => { for await(const m of sub) { console.log(“\n”, m.subject); m.ack(); } })().then(()=>{console.log(…)}).catch((err) => { //something bad});

Read more comments on GitHub >

github_iconTop Results From Across the Web

Messages targeted to one durable consumer received by ...
I'm experiencing issues with the creation of multiple consumers to the same stream. As per the reproduction steps below, when more than one ......
Read more >
JetStream Consumers with the NATS.io Java Library
The server sends messages to push consumers while pull consumers have to ask for messages. This is mentioned here first because consumer ......
Read more >
NATS C Client with JetStream and Streaming support: status.h ...
Error when parsing a protocol message, or not getting the expected ... Deliver subject not valid. ... Consumer in pull mode can not...
Read more >
NATS JetStream - ThinkMicroservices.com
Today we will complete our coverage of NATS by introducing NATS JetStream message streaming and demonstrate how to integrate it into yet another ......
Read more >
mod.rs - source - Docs.rs
Therefore the error case must come first, otherwise it can be ignored. ... Consumer in pull mode can not have rate limit set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found