2

How can I receive amount of messages stored in the queue using qpid library on python?

I have tried like this:

from qpid.messaging import *

broker_rcv = connect_address 
address_rcv = queue_name  + "; { node: { type: queue }, assert: never , create: never, mode: " + "browse" + " }"
connection_rcv = Connection(broker_rcv)
connection_rcv.open()
session_rcv = connection_rcv.session()
receiver = session_rcv.receiver(address_rcv)
print receiver.available()

And it always return me 0 messages.

Kara
  • 6,115
  • 16
  • 50
  • 57
user1209304
  • 408
  • 1
  • 5
  • 26

2 Answers2

1

I have soloved this by adding receiver.capacity = 250. But if I have more messages in the queue and call receiver.available() I recive 250. But it's not a big problem now.

Botz3000
  • 39,020
  • 8
  • 103
  • 127
user1209304
  • 408
  • 1
  • 5
  • 26
0

I have been facing the same problem . But my last goal was that to stop and resume messages in queue. I found this:

qpidd --default-flow-stop-threshold=90 --default-flow-resume-threshold=75

or check this link: https://qpid.apache.org/releases/qpid-cpp-0.34/cpp-broker/book/producer-flow-control.html

This may help you.

Manoj Sahu
  • 2,774
  • 20
  • 18