WorkerSetup typedef

WorkerSetup = FutureOr<WorkerApp> Function(WorkerContext context)

Builds one worker's application. It runs inside the worker's isolate, so whatever it creates (pool, repositories, router) belongs to that worker alone.

The function itself is sent to the isolate: a closure that captures an object that cannot cross isolates (an open pool, a ReceivePort, a SecurityContext) makes the start fail.

Implementation

typedef WorkerSetup = FutureOr<WorkerApp> Function(WorkerContext context);