Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to only process a message received for a certain correlation id (or other property) #411

Open
psyciknz opened this issue Feb 1, 2023 · 1 comment

Comments

@psyciknz
Copy link

psyciknz commented Feb 1, 2023

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.

@psyciknz
Copy link
Author

psyciknz commented Feb 1, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant