Skip to content

Provide a findAll endpoint on SessionRepository #405

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

Closed
bcecchinato opened this issue Mar 2, 2016 · 8 comments
Closed

Provide a findAll endpoint on SessionRepository #405

bcecchinato opened this issue Mar 2, 2016 · 8 comments
Assignees
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@bcecchinato
Copy link

It would be nice to have the possibility to retrieve all sessions on a repository. This would allow for instance to make operations on sessions in non-http requests (batchs for instance).

One use case could be the use of the new endpoint with actuator, to display the count of sessions on every instance of an application (compared to local count of HttpSession).

Regards,

@rwinch
Copy link
Member

rwinch commented Mar 2, 2016

@bcecchinato Thanks you for your feedback!

One of our goals is to keep the APIs we provide rather light. This makes it easy for providing additional implementations. Many of the data stores are key value stores and have certain limitations. For example, paging the results can become tricky, finding by properties can be tricky etc.

I'm not saying we can't or won't do this, but adding new APIs is something we will do with strong reservation for the reasons listed above.

It would be nice to have the possibility to retrieve all sessions on a repository. This would allow for instance to make operations on sessions in non-http requests (batchs for instance).

Can you explain why you need findAll for non-http requests?

One use case could be the use of the new endpoint with actuator, to display the count of sessions on every instance of an application (compared to local count of HttpSession).

This makes sense.

@bcecchinato
Copy link
Author

@rwinch Thanks for the quick answer.

Can you explain why you need findAll for non-http requests?

My use case is the following : I have an administration website, that will display all the sessions (whatever the status). We also have the possibility to "kill" a session. This is what I mean by "non-http requests". Instead of retrieving a complete list of all sessions, maybe a list of all ids should be more simple to handle (and then a loop on SessionRepository#getSession).

But I do agree that paging would be a huge pain to implement.

Maybe my way of thinking is wrong. As this is a specific request, I might end up using my own implementation (using RedisOperations, or Hazelcast), with some kind of wrapper over spring-session.

@rwinch
Copy link
Member

rwinch commented Mar 2, 2016

@bcecchinato Can the admin page require searching by the username? Most likely you won't identify the session to kill by the id anyways right? If so, we support finding sessions by username See http://docs.spring.io/spring-session/docs/current/reference/html5/guides/findbyusername.html

@rwinch
Copy link
Member

rwinch commented Mar 2, 2016

@bcecchinato PS If you put together an actuator endpoint for killing sessions, I'd love to see that contributed!

@bcecchinato
Copy link
Author

@rwinch

Can the admin page require searching by the username? Most likely you won't identify the session to kill by the id anyways right? If so, we support finding sessions by username See http://docs.spring.io/spring-session/docs/current/reference/html5/guides/findbyusername.html

I didn't planned to make a proper search by username. My idea was to display session attributes (like a table with static fields). I haven't finished to review what I will implement so far.

PS If you put together an actuator endpoint for killing sessions, I'd love to see that contributed!

I might have a look on this as it could interest more people.

@rwinch
Copy link
Member

rwinch commented Mar 2, 2016

@bcecchinato I've actually planned on such a feature (to destroy sessions). However, it would require searching by username. This would ensure paging wasn't a problem (in most cases) since any one user is unlikely to have more than 100 connections (hopefully quite a few less).

I also have a prototype of changing log levels by username. This would be good for troubleshooting a specific user's problems. It would also be added to the actuator endpoint.

I'd really encourage you to do an actuator endpoint that operates by username. I know the community (and I) will love it!

@rwinch
Copy link
Member

rwinch commented Mar 2, 2016

I created #407 and #408 to document these ideas. Again, I'd love for you or anyone else to jump in and work on them. I know the community will be very excited for them!

@rwinch rwinch closed this as completed Sep 13, 2016
@rwinch
Copy link
Member

rwinch commented Sep 13, 2016

Closing this issue as we don't plan on adding a findAll endpoint. User's can implement this themselves if they really need it, but it won't scale in most situations since paging is necessary and not supported by lots of the data stores

@rwinch rwinch self-assigned this Sep 13, 2016
@rwinch rwinch added the status: declined A suggestion or change that we don't feel we should currently apply label Sep 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

2 participants