Skip to main content

Pool

pool sets how many connections publishes, settlements and handler commands share; each subscription reads on a connection of its own.

The pool holds 4 connections unless the service sets another number. Replies, acknowledgements, retries and the commands a handler sends through FredPool take turns on them. Each stream and list subscription reads on one more connection, and each Pub/Sub subscription listens on one. So a blocking read never holds up a publish, and a service opens the pool plus one connection per subscription.

A pool of zero connections fails startup. A TestApp test keeps the pool size, and refuses zero the same way.

Example​

The service answers each order with a receipt through a pool of sixteen connections.

/// Sixteen pooled connections for the replies and acknowledgements of a busy service.
#[ruststream::app]
fn app() -> impl App<State = ()> {
service(RedisBroker::standalone("redis://localhost:6379").pool(16))
}