pythonstompprefetchamq

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?


Solution

  • 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})