public class ReactiveMongoDatabaseUtils extends Object
MongoDatabase
instances via ReactiveMongoDatabaseFactory
. Used for
obtaining session bound
resources, such as MongoDatabase
and MongoCollection
suitable for transactional usage.
Note: Intended for internal usage only.Constructor and Description |
---|
ReactiveMongoDatabaseUtils() |
Modifier and Type | Method and Description |
---|---|
static reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase> |
getDatabase(ReactiveMongoDatabaseFactory factory)
|
static reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase> |
getDatabase(ReactiveMongoDatabaseFactory factory,
SessionSynchronization sessionSynchronization)
Obtain the default
database form the given factory . |
static reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase> |
getDatabase(String dbName,
ReactiveMongoDatabaseFactory factory)
|
static reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase> |
getDatabase(String dbName,
ReactiveMongoDatabaseFactory factory,
SessionSynchronization sessionSynchronization)
Obtain the
database with given name form the given factory . |
static reactor.core.publisher.Mono<Boolean> |
isTransactionActive(ReactiveMongoDatabaseFactory databaseFactory)
Check if the
ReactiveMongoDatabaseFactory is actually bound to a
ClientSession that has an active transaction, or if a
TransactionSynchronization has been registered for the
resource and if the associated
ClientSession has an
active transaction . |
public static reactor.core.publisher.Mono<Boolean> isTransactionActive(ReactiveMongoDatabaseFactory databaseFactory)
ReactiveMongoDatabaseFactory
is actually bound to a
ClientSession
that has an active transaction, or if a
TransactionSynchronization
has been registered for the
resource
and if the associated
ClientSession
has an
active transaction
.databaseFactory
- the resource to check transactions for. Must not be null.Mono
emitting true if the factory has an ongoing transaction.public static reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase> getDatabase(ReactiveMongoDatabaseFactory factory)
database
form the given factory
using
native session synchronization
.
Registers a MongoDB specific transaction synchronization
within the subscriber
Context
if synchronization is active
.factory
- the ReactiveMongoDatabaseFactory
to get the MongoDatabase
from.MongoDatabase
that is potentially associated with a transactional ClientSession
.public static reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase> getDatabase(ReactiveMongoDatabaseFactory factory, SessionSynchronization sessionSynchronization)
database
form the given factory
.
Registers a MongoDB specific transaction synchronization
within the subscriber
Context
if synchronization is active
.factory
- the ReactiveMongoDatabaseFactory
to get the MongoDatabase
from.sessionSynchronization
- the synchronization to use. Must not be null.MongoDatabase
that is potentially associated with a transactional ClientSession
.public static reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase> getDatabase(String dbName, ReactiveMongoDatabaseFactory factory)
database
with given name form the given factory
using native session synchronization
.
Registers a MongoDB specific transaction synchronization
within the subscriber
Context
if synchronization is active
.dbName
- the name of the MongoDatabase
to get.factory
- the ReactiveMongoDatabaseFactory
to get the MongoDatabase
from.MongoDatabase
that is potentially associated with a transactional ClientSession
.public static reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase> getDatabase(String dbName, ReactiveMongoDatabaseFactory factory, SessionSynchronization sessionSynchronization)
database
with given name form the given factory
.
Registers a MongoDB specific transaction synchronization
within the subscriber
Context
if synchronization is active
.dbName
- the name of the MongoDatabase
to get.factory
- the ReactiveMongoDatabaseFactory
to get the MongoDatabase
from.sessionSynchronization
- the synchronization to use. Must not be null.MongoDatabase
that is potentially associated with a transactional ClientSession
.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.