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

Provide an Actuator endpoint for non-indexed session repositories #10827

Closed
wilkinsona opened this issue Oct 30, 2017 · 8 comments
Closed

Provide an Actuator endpoint for non-indexed session repositories #10827

wilkinsona opened this issue Oct 30, 2017 · 8 comments
Assignees
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement

Comments

@wilkinsona
Copy link
Member

Spring Session's reactive support doesn't appear to have an equivalent of FindByIndexNameSessionRepository so the functionality of the current endpoint can't be ported over to a reactive view of the world. We'll need to figure out what to do there.

/cc @rwinch @vpavic

@wilkinsona wilkinsona added this to the 2.0.0.RC1 milestone Oct 30, 2017
@rwinch
Copy link
Member

rwinch commented Nov 1, 2017

@wilkinsona Thanks for reaching out. We are currently planning on adding support for finding by username for 2.1. For tracking I created spring-projects/spring-session#914

@wilkinsona
Copy link
Member Author

wilkinsona commented Nov 2, 2017

Thank you @rwinch. I’ll assign this one to our general 2.1 bucket for now on the assumption that our 2.1 schedules will align. We can adjust as needed if that’s not the case.

@wilkinsona wilkinsona modified the milestones: 2.0.0.RC1, 2.1 Nov 2, 2017
@mbhave mbhave added the status: blocked An issue that's blocked on an external project change label Jun 26, 2019
@wilkinsona wilkinsona changed the title Provide an Actuator endpoint for reactive sessions Provide an Actuator endpoint for non-indexed session repositories Aug 4, 2022
@wilkinsona wilkinsona removed the status: blocked An issue that's blocked on an external project change label Aug 4, 2022
@wilkinsona wilkinsona modified the milestones: General Backlog, 3.0.x Aug 4, 2022
@wilkinsona
Copy link
Member Author

We've repurposed this to provide an endpoint for an unindexed session repository that will allow sessions to be retrieved and deleted by ID. The ID will have to be found by some other means as listing all sessions will not be possible.

@vpavic
Copy link
Contributor

vpavic commented Aug 8, 2022

Could you clarify whether this issue is still focused on reactive stack only or is it a general (meaning, targeting both Servlet and reactive stacks) concern now? If it's a general concern sounds like the session endpoint should probably be refactored in a way to separate functionality that depends on only SessionRepository from bits that depend on FindByIndexNameSessionRepository.

Either way, I'd gladly help out with this one.

Also, is there an example of actuator endpoint (outside of health, but that one's quite complex) that supports both stacks?

@wilkinsona
Copy link
Member Author

Could you clarify whether this issue is still focused on reactive stack only or is it a general (meaning, targeting both Servlet and reactive stacks) concern now?

It's a general concern now.

refactored in a way to separate functionality that depends on only SessionRepository from bits that depend on FindByIndexNameSessionRepository

There are a few different ways this could be implemented. It should be possible for the existing SessionsEndpoint to take a SessionRepository and then do an instanceof check in sessionsForUsername, returning null when the repository isn't a FindByIndexNameSessionRepository.

Either way, I'd gladly help out with this one.

That would be great, thank you. I'll assign the issue to you.

Also, is there an example of actuator endpoint (outside of health, but that one's quite complex) that supports both stacks?

I don't think we'll need to support both WebFlux and Servlet (MVC and Jersey) in the same endpoint. Unlike health, we won't be in a position where there's a mixture of ReactiveSessionRepository and SessionRepository and we need to deal with both from the same endpoint. I think we should be able to auto-configure a SessionsEndpoint if there's a SessionRepository bean or a new ReativeSessionsEndpoint bean if there's a ReativeSessionRepository.

@vpavic
Copy link
Contributor

vpavic commented Aug 9, 2022

returning null when the repository isn't a FindByIndexNameSessionRepository

Thanks for confirming this. I missed this paragraph while skimming through the docs yesterday so I was unsure whether null returned from the endpoint operation would be translated to 404.

I think we should be able to auto-configure a SessionsEndpoint if there's a SessionRepository bean or a new ReativeSessionsEndpoint bean if there's a ReativeSessionRepository.

That's how I too saw things initially but the part I'm unsure about is whether it's acceptable for two different endpoint implementations to be annotated with @Endpoint using the same id. I don't think there's an example of that in the codebase.

@wilkinsona
Copy link
Member Author

is whether it's acceptable for two different endpoint implementations to be annotated with @endpoint using the same id

I think it should be fine as long as only one is auto-configured at a time. One uncertainty is the configuration properties annotation processor that generates metadata for each endpoint. I'm not sure what it'll do if it encounters two endpoints with the same ID. It would be fairly quick to try it and see.

vpavic added a commit to vpavic/spring-boot that referenced this issue Aug 9, 2022
vpavic added a commit to vpavic/spring-boot that referenced this issue Aug 10, 2022
vpavic added a commit to vpavic/spring-boot that referenced this issue Aug 12, 2022
At present, Actuator sessions endpoint is supported only on a Servlet stack and also requires an indexed session repository. With Spring Session moving to non-indexed session repositories as a default for some session stores, this means that sessions endpoint won't be available unless users opt into a (non-default) indexed session repository.

This commit updates SessionEndpoint so that it is able to work with a non-indexed session repository. In such setup, it exposes operations for fetching session by id and deleting the session.

Additionally, this also adds support for reactive stack by introducing ReactiveSessionEndpoint and its auto-configuration support.

Closes spring-projectsgh-10827
@wilkinsona
Copy link
Member Author

Closing in favor of #32046.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2022
@wilkinsona wilkinsona removed this from the 3.0.x milestone Sep 1, 2022
@wilkinsona wilkinsona added the status: superseded An issue that has been superseded by another label Sep 1, 2022
mhalbritter pushed a commit to mhalbritter/spring-boot that referenced this issue Jan 18, 2024
At present, Actuator sessions endpoint is supported only on a Servlet stack and also requires an indexed session repository. With Spring Session moving to non-indexed session repositories as a default for some session stores, this means that sessions endpoint won't be available unless users opt into a (non-default) indexed session repository.

This commit updates SessionEndpoint so that it is able to work with a non-indexed session repository. In such setup, it exposes operations for fetching session by id and deleting the session.

Additionally, this also adds support for reactive stack by introducing ReactiveSessionEndpoint and its auto-configuration support.

Closes spring-projectsgh-10827
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants