“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
Possible to only process a message received for a certain correlation id (or other property) #411
I'm change a local process to use activemq via stomp.
There is a process that happens when I enqueue a message that I need to be able to check the status of. I have verified but manually sending a message to the input queue, that if I set a correlation id, that it kept for the reply which is on an output queue. So where there might be lots of messages I can tie these together.
The problem is, my program will be stateless. It will be run upon a new file arriving, and that file name will be given to the input queue, and if there are problems a message will end up on the output queue within a second. I would like for my program to wait for a response on the output queue, but only where the correlation ids match....so if there are other messages on the queue I'd like to ignore those as another instance of the program is most likely waiting for that.
Is this possible? or by using unique client names, or any other property where my subscription can only wait for messages from itself.
I can't alter the queue names as they are used by an external process.
I have by using your tests, figure out how to get my method to wait for a response message via listener.wait_for_message - and for 90% of the time, the number of messages are slow enough that this shouldn't be an issue. But I'd prefer to process any messages in the queue, and if not my correlation id, not pull them off the queue.
I think I managed to work it out. But setting subscribe to client ack. And I can test correlation id on each message. If they don't match I can nack the message else ack it, and process it.
I'm change a local process to use activemq via stomp.
There is a process that happens when I enqueue a message that I need to be able to check the status of. I have verified but manually sending a message to the input queue, that if I set a correlation id, that it kept for the reply which is on an output queue. So where there might be lots of messages I can tie these together.
The problem is, my program will be stateless. It will be run upon a new file arriving, and that file name will be given to the input queue, and if there are problems a message will end up on the output queue within a second. I would like for my program to wait for a response on the output queue, but only where the correlation ids match....so if there are other messages on the queue I'd like to ignore those as another instance of the program is most likely waiting for that.
Is this possible? or by using unique client names, or any other property where my subscription can only wait for messages from itself.
I can't alter the queue names as they are used by an external process.
I have by using your tests, figure out how to get my method to wait for a response message via listener.wait_for_message - and for 90% of the time, the number of messages are slow enough that this shouldn't be an issue. But I'd prefer to process any messages in the queue, and if not my correlation id, not pull them off the queue.