GH-905: Fix @RabbitListener Thread Names

Fixes https://github.com/spring-projects/spring-amqp/issues/905

Default container thread names are based on the bean name. `@RabbitListener`
containers are not beans; use `getListenerId()` instead (which falls back
to bean name for other containers).

**cherry-pick to all supported branches**

(cherry picked from commit 5f4c60a969)
This commit is contained in:
Artem Bilan
2019-02-18 12:03:19 -05:00
parent 9f7b65ba27
commit 723499fff0

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -797,8 +797,8 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
if (!this.isExposeListenerChannel() && this.transactionManager != null) {
logger.warn("exposeListenerChannel=false is ignored when using a TransactionManager");
}
if (!this.taskExecutorSet && StringUtils.hasText(this.getBeanName())) {
this.taskExecutor = new SimpleAsyncTaskExecutor(this.getBeanName() + "-");
if (!this.taskExecutorSet && StringUtils.hasText(getListenerId())) {
this.taskExecutor = new SimpleAsyncTaskExecutor(getListenerId() + "-");
this.taskExecutorSet = true;
}
initializeProxy();