5

Is it somehow possible to use Spring's RSocket integration in a "traditional" servlet-based Spring application without having to sacrifice functionality that Spring offers according to the documentation if you do not mix the two variants?

If so, how? Are there any pitfalls to be aware of?

The objective would be to allow an existing Servlet-based Spring application to talk to various clients over RSocket. A fully reactive experience with backpressure is neither expected nor necessary on the server side. Having to start a separate Netty-based server that runs alongside the servlet container is okay and expected.

To address questions raised in the comments, there is some functionality I am especially concerned about:

  • Does declarative transaction support work for requests that come in via RSocket without having to use R2DBC? According to Reactive Transactions with Spring imperative and reactive transaction management differ significantly.
  • Does Spring Security "just" work? Or is special configuration necessary, for example, to use @PreAuthorize on methods that are invoked by the servlet-based parts and the RSocket-based parts of the application?
3
  • Can you elaborate more in your question that how would you be sacrificing Tx support by using the RSocket integration in a servlet-based env ? Is there such limitation ? Commented Sep 11, 2023 at 2:42
  • I mean the docs says "Spring Security 5.2 provides RSocket support." Also, how would a WebSocket connection be participating in a Transaction anyways ? Commented Sep 11, 2023 at 2:51
  • @alegria I've tried to clarify the question. "Is there such limitation" -- I don't know, that's why I'am asking. The Spring docs generally stress how different those stacks are so I'm a bit wary. Same with Spring Security: Yes, it provides RSocket support, but does it play nice when both the imperative and reactive stack are enabled? My testing indicates it does not, at least out of the box.@PreAuthorize is always handled by the imperative stack. Commented Sep 11, 2023 at 12:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.