user3357415
user3357415

Reputation: 79

How do I get my AMQP 1.0 consumer to keep track of messages already consumed using ActiveMQ

I am using a ActiveMQ AMQP broker, every time I run my consumer I get all the message in the queue. This is good, however I need a way to limit the messages I read based on what I have not already read the prior time I ran my consumer. What I mean is, I only want to see new messages. Is there a way to send an offset to ActiveMQ broker or to send it some sort of unique identifier so that it knows what I already consumed and it only sends me newer content? Any help would be appreciated.

Upvotes: 1

Views: 346

Answers (1)

Petter Nordlander
Petter Nordlander

Reputation: 22279

You are not really supposed to keep data around in the broker when it's been read. ActiveMQ is a temporary storage, not a database. Keeping old data around on purpose will have multiple implications - specifically in the persistence store if using persistent messages.

I guess you are not acking/commiting the transaction or browsing the queue. If you commit the transaction after you have read your message/messages then they will be removed and will not appear the next time you attempt to read the queue.

Upvotes: 1

Related Questions