diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessagingMessageListenerAdapter.java b/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessagingMessageListenerAdapter.java index f82a274fdd..16e3177bba 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessagingMessageListenerAdapter.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessagingMessageListenerAdapter.java @@ -20,6 +20,7 @@ import jakarta.jms.JMSException; import jakarta.jms.Session; import org.springframework.core.MethodParameter; +import org.springframework.jms.listener.SubscriptionNameProvider; import org.springframework.jms.support.JmsHeaderMapper; import org.springframework.jms.support.converter.MessageConversionException; import org.springframework.lang.Nullable; @@ -48,7 +49,8 @@ import org.springframework.util.Assert; * @see JmsHeaderMapper * @see InvocableHandlerMethod */ -public class MessagingMessageListenerAdapter extends AbstractAdaptableMessageListener { +public class MessagingMessageListenerAdapter extends AbstractAdaptableMessageListener + implements SubscriptionNameProvider { @Nullable private InvocableHandlerMethod handlerMethod; @@ -67,6 +69,16 @@ public class MessagingMessageListenerAdapter extends AbstractAdaptableMessageLis return this.handlerMethod; } + @Override + public String getSubscriptionName() { + if (this.handlerMethod != null) { + return this.handlerMethod.getBeanType().getName() + "#" + this.handlerMethod.getMethod().getName(); + } + else { + return this.getClass().getName(); + } + } + @Override public void onMessage(jakarta.jms.Message jmsMessage, @Nullable Session session) throws JMSException {