Class: RabbitCloser
Defined in: src/graceful-shutdown/rabbit-closer.ts:14
Orchestrates an orderly shutdown of all registered producers, consumers, channels, and connections.
Shutdown order: producers → consumers → channels → connections.
Constructors
Constructor
new RabbitCloser(
connections,consumers,producers):RabbitCloser
Defined in: src/graceful-shutdown/rabbit-closer.ts:20
Parameters
| Parameter | Type | Description |
|---|---|---|
connections | Connection[] | Connections to close after all producers and consumers have stopped. |
consumers | (Consumer<unknown, Record<string, unknown>> | BatchConsumer<unknown, Record<string, unknown>>)[] | Consumers to stop before closing channels and connections. |
producers | Producer<unknown, unknown>[] | Producers to stop first, waiting for all pending publishes to settle. |
Returns
RabbitCloser
Methods
close()
close(
timeout?):Promise<void>
Defined in: src/graceful-shutdown/rabbit-closer.ts:36
Performs the orderly shutdown sequence with an optional overall timeout budget. Each stage receives the remaining milliseconds at the moment it starts, so later stages (channels, connections) get progressively less time than earlier ones. Waits for each stage to complete before proceeding to the next. Follows sequence: producers → consumers → channels → connections.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
timeout | number | 60_000 | Total budget in milliseconds for the entire shutdown sequence. When omitted, each stage waits indefinitely. |
Returns
Promise<void>