Class ReactivePostgresSessionRepository

java.lang.Object
net.andreaskluth.session.postgres.ReactivePostgresSessionRepository
All Implemented Interfaces:
org.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>

public class ReactivePostgresSessionRepository
extends java.lang.Object
implements org.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
A ReactiveSessionRepository that is implemented using vert.x reactive postgres client.
  • Constructor Summary

    Constructors 
    Constructor Description
    ReactivePostgresSessionRepository​(io.vertx.sqlclient.Pool pool, SerializationStrategy serializationStrategy, java.time.Clock clock)
    Creates a new instance.
  • Method Summary

    Modifier and Type Method Description
    reactor.core.publisher.Mono<java.lang.Integer> cleanupExpiredSessions()  
    reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession> createSession()  
    reactor.core.publisher.Mono<java.lang.Void> deleteById​(java.lang.String id)  
    reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession> findById​(java.lang.String id)  
    reactor.core.publisher.Mono<java.lang.Void> save​(net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession postgresSession)  
    void setDefaultMaxInactiveInterval​(int defaultMaxInactiveInterval)
    Sets the maximum inactive interval in seconds between requests before newly created sessions will be invalidated.
    void setSequenceName​(java.lang.String sequenceName)
    Set a custom sequence name used for metrics see Mono.name(String).
    void withMetrics​(boolean enableMetrics)
    Activates Mono.metrics() for all operations.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • withMetrics

      public void withMetrics​(boolean enableMetrics)
      Activates Mono.metrics() for all operations.
      Parameters:
      enableMetrics - whether metrics should be generated or not.
    • setSequenceName

      public void setSequenceName​(java.lang.String sequenceName)
      Set a custom sequence name used for metrics see Mono.name(String).
      Parameters:
      sequenceName - overrides the default sequence name
    • setDefaultMaxInactiveInterval

      public void setDefaultMaxInactiveInterval​(int defaultMaxInactiveInterval)
      Sets the maximum inactive interval in seconds between requests before newly created sessions will be invalidated. A negative time indicates that the session will never timeout. The default is 1800 (30 minutes).
      Parameters:
      defaultMaxInactiveInterval - the number of seconds that the Session should be kept alive between client requests.
    • createSession

      public reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession> createSession()
      Specified by:
      createSession in interface org.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
    • save

      public reactor.core.publisher.Mono<java.lang.Void> save​(net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession postgresSession)
      Specified by:
      save in interface org.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
    • findById

      public reactor.core.publisher.Mono<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession> findById​(java.lang.String id)
      Specified by:
      findById in interface org.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
    • deleteById

      public reactor.core.publisher.Mono<java.lang.Void> deleteById​(java.lang.String id)
      Specified by:
      deleteById in interface org.springframework.session.ReactiveSessionRepository<net.andreaskluth.session.postgres.ReactivePostgresSessionRepository.PostgresSession>
    • cleanupExpiredSessions

      public reactor.core.publisher.Mono<java.lang.Integer> cleanupExpiredSessions()