Replies: 1 comment
-
@willnufe RabbitMQ returns actual message count only in declraration frame, so use should get and save somewhere real queue object by Just a little code snippet: from faststream import FastStream
from faststream.rabbit import RabbitBroker, RabbitQueue
broker = RabbitBroker()
app = FastStream(broker)
@broker.subscriber("test-queue")
async def handler(msg): ...
@app.after_startup
async def t():
# get queue object
queue_obj = await broker.declare_queue(RabbitQueue("test-queue", passive=True))
# ask for declaration frame
declare_frame = await queue_obj.declare()
actual_message_count = declare_frame.message_count
print(actual_message_count) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, i'm using
RabbitRouter
.How can I obtain the length of the specified RabbitMQ message queue
test
?Beta Was this translation helpful? Give feedback.
All reactions