Variable: lifecycle
constlifecycle:Lifecycle<"init"|"start"|"ready">
Defined in: src/utils/lifecycle.ts:330
The default stages, in order: init (wire contributions, migrate, warm up), start (begin accepting work: listen, start consumers) and ready (announce: readiness probe, service discovery). Stopping undoes them in reverse.
Example
ts
const addPayments = (c: ServiceRegistry<{ bus: Bus }>) =>
c
.addSingleton('consumer', PaymentConsumer, ['bus'])
.addSingleton(lifecycle.start('consumer'), (consumer) => {
consumer.start();
return () => consumer.stop();
}, ['consumer']);