Add shutdown handling so local restarts and production deployments do not leave background work or in-flight messages behind.
Explicitly exiting after service.stop() also keeps deno task dev or other watched local dev restarts from leaving the old process around.
Deno.addSignalListener("SIGTERM", async () => {
await service.stop();
Deno.exit(0);
}); For Node.js, use process.on("SIGTERM", ...).