Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose @JmsListener endpoint id to annotation-derived listener container (for transaction definition name) #26683

Closed
zerocode opened this issue Mar 15, 2021 · 1 comment
Assignees
Labels
in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement
Milestone

Comments

@zerocode
Copy link

Transaction name is always null when debug logging @Transactional`` @JmsListener methods.

This chunk of code in AbstractPollingMessageListenerContainer returns null for getBeanName():

                                // Use bean name as default transaction name.
                                if (this.transactionDefinition.getName() == null) {
                                                String beanName = getBeanName();
                                                if (beanName != null) {
                                                                this.transactionDefinition.setName(beanName);
                                                }
                                }

It should be easy to support by setting the beanName from the endpoint passed into createListenerContainer(JmsListenerEndpoint endpoint) { ... } in AbstractJmsListenerContainerFactory.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 15, 2021
@jhoeller jhoeller self-assigned this Mar 15, 2021
@jhoeller jhoeller added in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Mar 15, 2021
@jhoeller jhoeller added this to the 5.3.5 milestone Mar 15, 2021
@jhoeller jhoeller changed the title Bean name not exposed to annotation-derived listener container in SpringJms - transactionDefinition name is always null. Expose @JmsListener endpoint id to annotation-derived listener container (for transaction definition name) Mar 15, 2021
@jhoeller
Copy link
Contributor

As a side note, exposing the endpoint id also enables the listener container to use specific thread names based on that id, just like the bean name for a manually defined listener container is also showing up in the thread names (with the default task executor).

This was referenced Mar 16, 2021
This was referenced Mar 17, 2021
lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this issue Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants