public class ReactiveMongoSessionRepository extends java.lang.Object implements ReactiveSessionRepository<MongoSession>, org.springframework.context.ApplicationEventPublisherAware, org.springframework.beans.factory.InitializingBean
ReactiveSessionRepository
implementation that uses Spring Data MongoDB.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_COLLECTION_NAME
The default collection name for storing session.
|
static int |
DEFAULT_INACTIVE_INTERVAL
The default time period in seconds in which a session will expire.
|
Constructor and Description |
---|
ReactiveMongoSessionRepository(org.springframework.data.mongodb.core.ReactiveMongoOperations mongoOperations) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Do not use
ReactiveIndexOperations to
ensure indexes exist. |
reactor.core.publisher.Mono<MongoSession> |
createSession()
Creates a new
MongoSession that is capable of being persisted by this
ReactiveSessionRepository . |
reactor.core.publisher.Mono<java.lang.Void> |
deleteById(java.lang.String id)
|
reactor.core.publisher.Mono<MongoSession> |
findById(java.lang.String id)
|
java.lang.String |
getCollectionName() |
java.lang.Integer |
getMaxInactiveIntervalInSeconds() |
reactor.core.publisher.Mono<java.lang.Void> |
save(MongoSession session)
Ensures the
Session created by
ReactiveSessionRepository.createSession() is saved. |
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher) |
void |
setBlockingMongoOperations(org.springframework.data.mongodb.core.MongoOperations blockingMongoOperations) |
void |
setCollectionName(java.lang.String collectionName) |
void |
setMaxInactiveIntervalInSeconds(java.lang.Integer maxInactiveIntervalInSeconds) |
void |
setMongoSessionConverter(AbstractMongoSessionConverter mongoSessionConverter) |
public static final int DEFAULT_INACTIVE_INTERVAL
public static final java.lang.String DEFAULT_COLLECTION_NAME
public ReactiveMongoSessionRepository(org.springframework.data.mongodb.core.ReactiveMongoOperations mongoOperations)
public reactor.core.publisher.Mono<MongoSession> createSession()
MongoSession
that is capable of being persisted by this
ReactiveSessionRepository
.
This allows optimizations and customizations in how the MongoSession
is
persisted. For example, the implementation returned might keep track of the changes
ensuring that only the delta needs to be persisted on a save.
createSession
in interface ReactiveSessionRepository<MongoSession>
MongoSession
that is capable of being persisted by this
ReactiveSessionRepository
public reactor.core.publisher.Mono<java.lang.Void> save(MongoSession session)
ReactiveSessionRepository
Session
created by
ReactiveSessionRepository.createSession()
is saved.
Some implementations may choose to save as the Session
is updated by
returning a Session
that immediately persists any changes. In this case,
this method may not actually do anything.
save
in interface ReactiveSessionRepository<MongoSession>
session
- the Session
to savepublic reactor.core.publisher.Mono<MongoSession> findById(java.lang.String id)
ReactiveSessionRepository
findById
in interface ReactiveSessionRepository<MongoSession>
id
- the Session.getId()
to lookupSession
by the Session.getId()
or null if no
Session
is found.public reactor.core.publisher.Mono<java.lang.Void> deleteById(java.lang.String id)
ReactiveSessionRepository
deleteById
in interface ReactiveSessionRepository<MongoSession>
id
- the Session.getId()
to deletepublic void afterPropertiesSet()
ReactiveIndexOperations
to
ensure indexes exist. Instead, get a blocking IndexOperations
and use that
instead, if possible.afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
setApplicationEventPublisher
in interface org.springframework.context.ApplicationEventPublisherAware
public java.lang.Integer getMaxInactiveIntervalInSeconds()
public void setMaxInactiveIntervalInSeconds(java.lang.Integer maxInactiveIntervalInSeconds)
public java.lang.String getCollectionName()
public void setCollectionName(java.lang.String collectionName)
public void setMongoSessionConverter(AbstractMongoSessionConverter mongoSessionConverter)
public void setBlockingMongoOperations(org.springframework.data.mongodb.core.MongoOperations blockingMongoOperations)