jasonrbriggs / stomp.py

“stomp.py” is a Python client library for accessing messaging servers (such as ActiveMQ or RabbitMQ) using the STOMP protocol (versions 1.0, 1.1 and 1.2). It can also be run as a standalone, command-line client for testing.
Apache License 2.0
491 stars 167 forks source link

Subscription Wildcards Support? #416

Closed tseanard closed 8 months ago

tseanard commented 1 year ago

Does this library (and/or the protocol) support subscribing to Queues (ActiveMQ) with wildcards? If yes, I cannot find how in the documentation. If no, is that because it is not supported in the STOMP protocol and/or ActiveMQ?

If it is supported by the protocol and just not implemented, I can contribute, but I am looking for more information from those who know prior to trying to go digging much further. Further question, is there support implemented for enumerating queues currently on the broker (which could support having my app handle multiple subscription by working the enumeration...)

Example: ActiveMQ Broker has three queues:

I would like to (one of):

jasonrbriggs commented 8 months ago

I believe that functionality would need to be supported by activemq. There's nothing specific in the stomp protocol (nor stomp.py) that I'm aware of to support wildcards.

tseanard commented 8 months ago

I had forgotten that I had logged this issue here, and had later solved the issue that I was having. Entering the solution here for others who may be looking to find it later.

On using wildcards to consume from ActiveMQ Queues using Stomp.py The root of my issue was that I was not using a valid path separator. I was using the '/' character. Upon further review of the documentation, the '/' character could be the path separator, but the default path separator is actually the '.' character. After updating the naming of my queues in my application, I have been using Stomp.py with wildcards for several months in production. This wildcard support is something that is supported by ActiveMQ (when you do it right), and does not require anything special in STOMP.py or the stomp protocol - it's just that the queue that you subscribe to has a wild card in the string and ActiveMQ does what it needs to do.

ActiveMQ Wildcard Reference: https://activemq.apache.org/wildcards

On Enumerating Queues Currently on the Broker I was able to confirm that this just isn't a thing via the STOMP protocol. I believe (aka found but lost the reference) that there are ways to enumerate the queues via API calls, but I have not run them to ground because once I solved the wildcards challenge I no longer needed the queue enumeration.