0

I am using the DefaultMessageListenerContainer with ActiveMQ. While the listener is still running I want to briefly stop consuming messages lets say for 30 mins without stopping the container.

DefaultMessageListenerContainer.stop() will help me do this but I do not want to use this.

Is there a way to achieve this?

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • Why don't you want to use `stop()` on the DMLC? – Justin Bertram Nov 05 '20 at 01:07
  • My requirement is.. there is a scheduler that will run every 30 mins to check a database field that users sets, to determine whether to start or stop the DMLC. Lets say at 9 am the DB field is set to true the DMLC will be running... at 9:10 am the DB field is set to false the scheduler will stop DMLC at 9:30 ..... but I want it to stop cosuming msgs from 9:10 to 9:30 as well without stopping DMLC. – sstkoverflowcoder Nov 05 '20 at 06:34
  • Hi Justin Bertram @JustinBertram ... Could you please see my comment and suggest how to proceed. – sstkoverflowcoder Nov 09 '20 at 17:05
  • Man purpose of DMLC is to consume messages. Stop method is used to stop consuming messages. That's it. There is no other way. If you have "gaps in time" you don't fix that by making DMLC smarter but by running your scheduler more often like once a minute or whatever. – Talijanac Nov 12 '20 at 11:19

0 Answers0