Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Paste
P256
Count queue messages with Pika
Active
Public
Actions
Authored by
dereckson
on Jul 5 2017, 22:35.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
Notifications center
Message queues
Referenced Files
F527329: Count queue messages in a broker
Jul 5 2017, 22:35
2017-07-05 22:35:18 (UTC+0)
Subscribers
None
def
count_queue_messages
(
queue_name
):
connection
=
get_broker_connection
(
service
[
'config'
])
channel
=
connection
.
channel
()
result
=
channel
.
queue_declare
(
durable
=
True
,
queue
=
queue_name
,
passive
=
True
)
return
result
.
method
.
message_count
def
is_queue_empty
(
queue_name
):
return
count_queue_messages
(
queue_name
)
==
0
Event Timeline
dereckson
created this paste.
Jul 5 2017, 22:35
2017-07-05 22:35:18 (UTC+0)
dereckson
added a project:
Message queues
.
dereckson
changed the title of this paste from
Count queue messages in a broker
to
Count queue messages with Pika
.
Log In to Comment