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

Implement a ReactiveSessionRepository backed by R2DBC #1748

Open
rj93 opened this issue Dec 31, 2020 · 5 comments
Open

Implement a ReactiveSessionRepository backed by R2DBC #1748

rj93 opened this issue Dec 31, 2020 · 5 comments
Assignees
Labels
in: jdbc type: enhancement A general enhancement

Comments

@rj93
Copy link

rj93 commented Dec 31, 2020

Expected Behavior

Similar as the JDBC one, but for reactive applications.

Current Behavior

There is none.

Context

How has this issue affected you?

  • Currently have to deploy separate infrastructure such as Redis to achieve distributed sessions in a Spring Webflux application, such as ones that use sessions for authentication.

What are you trying to accomplish?

  • To have distributed sessions backed by a R2DBC connection.

What other alternatives have you considered?

  • Deploying additional infra that do have support for reactive web sessions.

Are you aware of any workarounds?

  • No.
@rj93 rj93 added status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement labels Dec 31, 2020
@eleftherias eleftherias removed the status: waiting-for-triage An issue we've not yet triaged label Jan 6, 2021
@eleftherias
Copy link
Contributor

Thanks for the suggestion @rj93.

I will keep this open as a feature request.

As a workaround, you can use a custom ReactiveSessionRepository.
You can find more information in the reference docs.

@zhouxos
Copy link

zhouxos commented Sep 29, 2022

+1

@marcusdacoregio
Copy link
Contributor

marcusdacoregio commented Sep 1, 2023

I will probably wait on spring-projects/spring-framework#27229 to get merged so we have a better way to batch insert/update/delete session attributes.

@marcusdacoregio
Copy link
Contributor

marcusdacoregio commented Aug 29, 2024

After trying different ways of doing batch inserts/updates I believe this will be kept on hold for now.

In Postgres, batch operations (concatenated statements with ;) do not accept parameters, and therefore, for Postgres there is a need to inline parameters (which opens up for injection attack vectors).
There are also variants for MySQL that accept like INSERT FIELDS(…) VALUES(…) VALUES(…) (multiple values elements).

I'm not sure yet if leveraging on multiple, separate transactional operations would be a nice alternative.

@dreamstar-enterprises
Copy link

dreamstar-enterprises commented Sep 1, 2024

I'm feeling burned out.

After spending 3 months trying to get Redis Session to work (it didn't), the delete functions wouldn't delete anything. I switched to MongoDB, gave up on that since MongoSession is private, and now am trying Jdbc wih a ReactiveSessionRegistry, but looks like I cannot implement that.

I seem cursed : (

@Component
internal class CustomSpringSessionReactiveSessionRegistry<S : Session>(
    private val jdbcIndexedSessionRepository: JdbcIndexedSessionRepository,
) : ReactiveSessionRegistry {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: jdbc type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants