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.

Remove the NACK during the stop_consuming

See original GitHub issue

Per conversation with @michaelklishin @lukebakken

Remove the nack during the channel.stop_consuming when the channel is closing the nack is not necessary

See also the SO question.

Internal link

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tango-taylorcommented, Sep 19, 2022

I edited the SO question with an even simpler example to trigger the bug, I’ll post it here:

Client

#!/usr/bin/env python
import pika

connection = pika.BlockingConnection(
    pika.ConnectionParameters(host='localhost')
)
channel_stream = connection.channel()

channel_stream.queue_declare(
    "stream-queue",
    durable=True,
    arguments={
        'x-queue-type': 'stream',
    }
)

for i in range(2):
    channel_stream.basic_publish(
        exchange='',
        routing_key='stream-queue',
        body=f"stream data".encode()
    )
connection.close()

Server

#!/usr/bin/env python
import pika

connection = pika.BlockingConnection(
    pika.ConnectionParameters(host='localhost')
)
channel_stream = connection.channel()

channel_stream.queue_declare(
    "stream-queue",
    auto_delete=False, exclusive=False, durable=True,
    arguments={
        'x-queue-type': 'stream',
    }
)
channel_stream.basic_qos(
    prefetch_count=1,
)


class Server(object):
    def __init__(self):
        channel_stream.basic_consume(
            queue="stream-queue",
            on_message_callback=self.stream_callback,
        )

    def stream_callback(self, channel, method, props, body):
        print(f"received '{body.decode()}' via {method.routing_key}")
        channel_stream.stop_consuming()


server = Server()

try:
    channel_stream.start_consuming()
except KeyboardInterrupt:
    connection.close()
0reactions
michaelklishincommented, Nov 19, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to stop consuming message from selective queue
Yes you can, using channel.basicCancel(consumerTag); EDIT For example: String tag3 = channel.basicConsume("queue3", consumer); channel.
Read more >
nifi back pressure threshholds - Cloudera Community - 198953
Solved: My back pressure threshold for number of objects is default 10000 while the data size is 1G. However, - 198953.
Read more >
Svchost.exe(netsvcs) won't stop consuming my Internet
Hey, I have been dealing with the netsvcs for a long time and i don't seem to find a solution. The svchost file...
Read more >
BlockingConnection — pika 1.2.1 documentation
While most of the asynchronous expectations are removed when using the blocking ... Specifies if the server supports basic.nack on the active connection....
Read more >
adjust/rmq: Message queue system written in Go and ... - GitHub
If the consumer dies by crashing or even by being gracefully shut down by calling StopConsuming() , the unacked deliveries will remain in...
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