0

Requirements:
In one project I need to fetch messages from topic. When my app will be restarted or started after the publisher already sent some messages the app should re-fetch but only the last message put on topic.

What I did:
I have created a spring jms listener which is a topic subscriber using annotation. It is a durable retroactive listener with a random client id so that it will fetch messages sent before subscription start and after every restart producer will treat it as a new subscriber and will send messages already consumed before the restart.

Problem:
After restart all previously sent messages are being fetched and the requirement is that only the last message sent will be fetched.

ActiveMQ is my message broker and I cannot administer it.

I will greatly appreciate any hint how to do that better? :)

Cheers

  • hello, you cannot use a static client id ? – Hassen Bennour Nov 27 '17 at 14:18
  • No, if I will do that after every app restart message broker will know that I have already fetched messages so I won't re-fetch them. :( It has to be durable so it can be retroactive and it has to have a different client id every time it starts to be able to fetch what it already did fetch during previous run. – Kamil Janyga Nov 27 '17 at 14:19
  • why : fetch what it already did fetch during previous run ?? – Hassen Bennour Nov 27 '17 at 14:37
  • On topic there is some periodically refreshed data used by the application when it is running and still there is a requirement that the application itself shouldn't persist anything. – Kamil Janyga Nov 27 '17 at 15:27

0 Answers0