Migration from spring boot 2.1.9.RELEASE >> 2.7.18 closes my Listener and it did not before

86 Views Asked by At

I moved my project from

  • java8 to java21
  • spring boot 2.1.9.RELEASE >> 2.7.18 (and thus spring-integration-jms 5.1.8.RELEASE >> 5.5.20)

In my code I have a controller returning SSE (TEXT_EVENT_STREAM_VALUE)

        return Flux.from(noticesUsersTopicJmsReactiveSource())
                .filter(m -> filterOutMyMessages(m, userName))
                .map(Message::getPayload);

The noticesUsersTopicJmsReactiveSource() is a @Bean that returns the reactive Publisher

        return IntegrationFlows
                .from(Jms.messageDrivenChannelAdapter(noticesUsersTopicDefaultMessageListenerContainer()))
                .channel(MessageChannels.publishSubscribe())
                .toReactivePublisher();

And the noticesUsersTopicDefaultMessageListenerContainer

    @Bean
    public DefaultMessageListenerContainer noticesUsersTopicDefaultMessageListenerContainer() {
        DefaultMessageListenerContainer d = new DefaultMessageListenerContainer();
        d.setConnectionFactory(topicConnectionFactory);
        d.setPubSubDomain(true);
        d.setDestinationName(noticesUsersTopic);        
        return d;
    }

In spring 2.1.9 When a browser connects, he receives the messages from the topics. (connection 1) When I refresh my browser, I create a second call to the controller. (connection 2) When a message from the topic comes in

  • tries to write to connection 1 -> it fails and closes that
  • tries to write to connection 2 -> is returned to the browser

in spring 2.7.18 When a browser connects, he receives the messages from the topics. (connection 1) When I refresh my browser, I create a second call to the controller. (connection 2) When a message from the topic comes in

  • tries to write to connection 2 -> is returned to the browser
  • tries to write to connection 1 -> it fails and closes that, but it also closes the messageListener

(so nothing of the topic comes in anymore)

*ChannelPublishingJmsMessageListener$GatewayDelegate - stopped org.springframework.integration.jms.ChannelPublishingJmsMessageListener$GatewayDelegate@23eb6d13 11:28:12 INFO o.s.i.j.JmsMessageDrivenEndpoint - stopped bean 'noticesUsersTopicJmsReactiveSource.jms:message-driven-channel-adapter#0'; defined in: 'class path resource [com/../configuration/NoticesUsersTopicConfiguration.class]'; from source: 'bean method noticesUsersTopicJmsReactiveSource' *

What could have changed?

All we want is a publisher of the topic messages. When a browser connects het gets the info, and when he disconnects, the publisher is still 'alive' for the next browser interested in topic messages.

Any help would be highly appreciated. Been debugging both versions for a couple of days now, and loosing my mind :-)

0

There are 0 best solutions below