spring-projects / spring-session

Spring Session
https://spring.io/projects/spring-session
Apache License 2.0
1.86k stars 1.11k forks source link

Implement a ReactiveSessionRepository backed by R2DBC #1748

Open rj93 opened 3 years ago

rj93 commented 3 years ago

Expected Behavior

Similar as the JDBC one, but for reactive applications.

Current Behavior

There is none.

Context

How has this issue affected you?

What are you trying to accomplish?

What other alternatives have you considered?

Are you aware of any workarounds?

eleftherias commented 3 years ago

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 commented 1 year ago

+1

marcusdacoregio commented 1 year ago

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

marcusdacoregio commented 2 weeks ago

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 commented 1 week ago

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 {