const classafMongo::ConnectionManagerPooled
sys::Obj afMongo::ConnectionManagerPooled : afMongo::ConnectionManager
Manages a pool of connections.
Connections are created on-demand and kept in a pool when idle.
Note this connection manager is safe for multi-threaded / web-application use.
- connectionUri
const Uri connectionUri
The URI this
ConnectionManager
was configured with.`mongodb://username:password@example1.com/puppies?maxPoolSize=50`
- defaultDatabase
const Str? defaultDatabase
The default database connections are authenticated against.
- defaultPassword
const Str? defaultPassword
The default password connections are authenticated with.
- defaultUsername
const Str? defaultUsername
The default username connections are authenticated with.
- leaseConnection
virtual override Obj? leaseConnection(|Connection->Obj? c)
Makes a connection available to the given function.
All leased connections are authenticated against the default credentials.
- makeFromUri
new makeFromUri(ActorPool actorPool, Uri connectionUri)
Create a
ConnectionManager
from a Mongo Connection URI. If user credentials are supplied, they are used as default authentication for each connection.The following Uri options are supported:
connectTimeoutMS TODO: socketTimeoutMS TODO: Write Concern Options
URI examples:
`mongodb://username:password@example1.com/database?maxPoolSize=50` `mongodb://example2.com?minPoolSize=10&maxPoolSize=50`
@see http://docs.mongodb.org/manual/reference/connection-string/
- maxPoolSize
const Int maxPoolSize := 10
The maximum number of database connections this pool should open. Set it to the number of concurrent users you expect to use your application.
- minPoolSize
const Int minPoolSize := 0
The minimum number of database connections this pool should keep open. They are initially created during
startup()
.- mongoUri
virtual const override Uri mongoUri
The host name of the MongoDB server this
ConnectionManager
connects to.- shutdown
virtual override ConnectionManager shutdown()
Closes all connections.
- startup
virtual override ConnectionManager startup()
Creates the initial pool and establishes
minPoolSize
connections with the server.