Skip to content

DefaultMessageListenerContainer reports incorrect jms.process.message count #33758

@sgnanask

Description

@sgnanask

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.

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions