spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

DefaultMessageListenerContainer reports incorrect jms.process.message count

Open sgnanask opened this issue 1 year ago • 0 comments

I have a simple JmsListener that is listening to messages published to an ActiveMQ classic queue

@JmsListener(destination = "ReportScheduleQueue") public void receiveMessage(String message) { log.info("Received message - {}", message); }

@Scheduled(cron = "0 */1 * ? * *") public void sendMessage() { jmsTemplate.convertAndSend("ReportScheduleQueue", "test message sent at " + new Date()); }

After a couple of message were triggered, I notice that the publish count is 2 but the process count is 4

"jms.message.process.error.none.exception.none.messaging.destination.name.ReportScheduleQueue.count": "4", "jms.message.publish.error.none.exception.none.messaging.destination.name.ReportScheduleQueue.count": "2"

Looks like both AbstractPollingMessageListenerContainer and AbstractMessageListenerContainer are recording the observation and since AbstractPollingMessageListenerContainer extends AbstractMessageListenerContainer , we end up reporting the process count twice.

sgnanask avatar Oct 20 '24 14:10 sgnanask