Skip to content

Consider adding event publishing hooks in JdbcOperationsSessionRepository #590

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

Open
vpavic opened this issue Aug 8, 2016 · 4 comments
Open
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@vpavic
Copy link
Contributor

vpavic commented Aug 8, 2016

Due to limitations of the underlying data store, JdbcOperationsSessionRepository has no session event publishing capabilities. However, since many projects do include a publish-subscribe broker of some sort, it could make sense to add hooks that would make use of that broker to route events to all members of a cluster.

With this change, JdbcOperationsSessionRepository would create session events and then pass them to strategy of some sort, which would be implemented by users if they wish to enable event publishing. JdbcOperationsSessionRepository would also implement some sort of message listener contract which would be responsible for using ApplicationEventPublisher to publish events locally.

What are your thoughts on this @rwinch? If you're open to this idea I'd like to implement it in time for 1.3.

@okohub
Copy link

okohub commented Dec 21, 2016

+1

@ksanta
Copy link

ksanta commented Jan 15, 2018

Our project creates "policy locks" in the database so only one person can action a policy at one time. Policy locks are essentially a record in a table and have a link to a session id. When a session expires, we would like any policy locks associated with that session to be removed.

I understand that session events are not enabled because there is no way to replicate that session state between all the cluster members, but the whole point of us moving the session to the database is so that our cluster members become stateless; we do not have to wait for sessions to drain before shutting down an instance for deployment.

@vpavic vpavic added the status: waiting-for-triage An issue we've not yet triaged label Jun 6, 2019
@joshiste
Copy link

Imho it's also worthy for collecting metrics on sessions: We want to collect session data (active count) on all of our instances and aggregate it in our monitoring. But the tomcat.sessions.active.current metric (from micrometer) always yields null because the the sessions are not managed by tomcat. And hooking in via the events/HttpSessionListener also doesn't work. (Also subclassing the JdbcIndexedSessionRepository is not possible because JdbcSession is package-private)

@vpavic
Copy link
Contributor Author

vpavic commented Aug 13, 2021

@joshiste Metrics are probably something worth looking at from a higher level. A while ago I opened #1495 to consider adding Micrometer integration. Please track (and vote) that issue if you're interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

4 participants