spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.4k stars 40.74k forks source link

JmsListener failing with Narayana (pooled ConnectionFactory) since 3.4.0 #43277

Closed graben closed 2 days ago

graben commented 4 days ago

The unwrapping code introduced with commit into JmsAnnotationDrivenConfiguration is causing issue with Narayana integration if using pooled ConnectionFactory because it unwraps the integration "magic" away.

Reproduce with attached demo. Btw. Narayana integration from https://github.com/snowdrop/narayana-spring-boot needs to be rebuilt as SNAPSHOT because latest 3.3.0 version is not build compatible with Spring Boot 3.4.0. (snowdrop/narayana-spring-boot#172)

demo.zip

FYI @snicoll

snicoll commented 3 days ago

Thanks for the sample, see also #39816.

is causing issue with Narayana

What does that mean? ~How do I reproduce the problem with the sample you've shared and what is the problem. I've tried to run the application and didn't see a problem except an exception on shutdown that can happen unfortunately with ActiveMQ.~ Nevermind, I see now that building Narayana is required.

snicoll commented 3 days ago

For those affected by the issue, you can add the following to your configuration to create a DefaultJmsListenerContainerFactory that doesn't do the unwrapping:

@Bean
DefaultJmsListenerContainerFactory jmsListenerContainerFactory(
        DefaultJmsListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory) {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    configurer.configure(factory, connectionFactory);
    return factory;
}

@graben I've added the above in DemoApplication and that restored the behavior for now.

graben commented 3 days ago

@snicoll: Thanks for the workaround. Works for me, too! ;-)