spring-messaging xml 配置 stomp 和 spring-sessions

spring-messaging xml config with stomp and spring-sessions

我正在尝试通过 spring-使用 stomp 的消息传递设置 WebSockets,并使用具有 spring-session 的 redis 支持的会话。我们的应用程序上下文通过 xml 连接,并且 spring-session 与应用程序的非 websocket 部分一起工作。 websocket相关配置如下

    <websocket:message-broker application-destination-prefix="/streaming" >
    <websocket:stomp-endpoint path="/data"> 
        <websocket:sockjs session-cookie-needed="false" />
    </websocket:stomp-endpoint>
    <websocket:stomp-broker-relay prefix="/topic" relay-host="${jms_hostname}" relay-port="${jms_stomp_port}" />
    <websocket:client-inbound-channel>
        <websocket:interceptors>
            <ref bean="sessionRepoMessageInterceptor"/>
            <ref bean="authenticationValidationInterceptor" />
            <ref bean="selectorValidationInterceptor" />
            <ref bean="selectorQuotingInterceptor" /> <!-- comes after we have validated the selector, we now shim it so JMS understands it -->
        </websocket:interceptors>
    </websocket:client-inbound-channel>
</websocket:message-broker>

我已经在此处定义了我认为 spring-session 与网络套接字集成所必需的 bean:

<bean id="redisSessionBackedWebsocketHandler" class="org.springframework.session.web.socket.server.">
</bean>

<bean id="sessionRepoMessageInterceptor" class="org.springframework.session.web.socket.server.SessionRepositoryMessageInterceptor">
</bean>

 <bean id="webSocketRegistryListener" class="org.springframework.session.web.socket.handler.WebSocketRegistryListener">
 </bean>

但我不确定将它们连接到 Web 套接字配置的位置,并且无法找到有关如何以这种方式进行操作的任何文档。

想法?

Spring Session WebSocket 仅包含 Java 和注释变体的配置。

并且根据 Spring Session Docs AbstractSessionWebSocketMessageBrokerConfigurer 为 Spring Session 和 Spring WebSockets 之间的无缝集成做了一些事情。但是在那里我们可以看到一些段落,它是做什么的:

To hook in the Spring Session support, we need to ensure ...

老实说,从 XML 配置这些东西并不容易。

随时关注问题:https://github.com/spring-projects/spring-session/issues/101