1

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.

user3357415
  • 94
  • 1
  • 10

1 Answers1

1

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.

Petter Nordlander
  • 22,053
  • 5
  • 50
  • 84
  • Peter can you give me an example on how to ack/commit the transaction, I am using t = mng.get(msg) mng.accept(t) But I can not get it to work. – user3357415 Jan 05 '15 at 19:24