Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set prefetch limit from stomp API

The AMQ docs note that the prefetch limit can be set when establishing a connection - is there a way to set the prefetch limit using stomp.py when instantiating a queue connection?

like image 856
category Avatar asked Sep 11 '25 06:09

category


1 Answers

I've asked myself this question as well, so if anyone still needs help with this issue:

It is possible to add ActiveMQ headers as dictionaries. The full list of possible configuration is here.

So for example to do what you needed to change prefetch limit, you need to add headers in subscribe:

connection = stomp.Connection()
connection.start()
connection.connect('username', 'password', wait=True)

# set callback
connection.set_listener('', self)
connection.subscribe(destination='/queue/test', id=1, ack='auto', headers={'activemq.prefetchSize': 1})
like image 165
wolfoorin Avatar answered Sep 13 '25 18:09

wolfoorin