diff --git a/webeoc/src/publishers/actions-taken-publisher.service.ts b/webeoc/src/publishers/actions-taken-publisher.service.ts index 863bf9b82..cfdb751da 100644 --- a/webeoc/src/publishers/actions-taken-publisher.service.ts +++ b/webeoc/src/publishers/actions-taken-publisher.service.ts @@ -17,6 +17,7 @@ export class ActionsTakenPublisherService { private async initializeNATS() { const nc = await connect({ servers: [process.env.NATS_HOST], + waitOnFirstConnect: true, }); this.jsClient = nc.jetstream(); } diff --git a/webeoc/src/publishers/complaints-publisher.service.ts b/webeoc/src/publishers/complaints-publisher.service.ts index 028c103bb..ec81d08bc 100644 --- a/webeoc/src/publishers/complaints-publisher.service.ts +++ b/webeoc/src/publishers/complaints-publisher.service.ts @@ -16,6 +16,7 @@ export class ComplaintsPublisherService { private async initializeNATS() { const nc = await connect({ servers: [process.env.NATS_HOST], + waitOnFirstConnect: true, }); this.jsClient = nc.jetstream(); } diff --git a/webeoc/src/subscribers/actions-taken-subscriber.service.ts b/webeoc/src/subscribers/actions-taken-subscriber.service.ts index 6d990b872..d80215384 100644 --- a/webeoc/src/subscribers/actions-taken-subscriber.service.ts +++ b/webeoc/src/subscribers/actions-taken-subscriber.service.ts @@ -19,7 +19,7 @@ export class ActionsTakenSubscriberService implements OnModuleInit { async onModuleInit() { try { - this.natsConnection = await connect({ servers: process.env.NATS_HOST }); + this.natsConnection = await connect({ servers: process.env.NATS_HOST, waitOnFirstConnect: true }); this.jsm = await this.natsConnection.jetstreamManager(); await this.setupStream(); await this.subscribeToTopics(); diff --git a/webeoc/src/subscribers/complaints-subscriber.service.ts b/webeoc/src/subscribers/complaints-subscriber.service.ts index c5ddf38de..218616e3a 100644 --- a/webeoc/src/subscribers/complaints-subscriber.service.ts +++ b/webeoc/src/subscribers/complaints-subscriber.service.ts @@ -19,7 +19,7 @@ export class ComplaintsSubscriberService implements OnModuleInit { async onModuleInit() { try { - this.natsConnection = await connect({ servers: process.env.NATS_HOST }); + this.natsConnection = await connect({ servers: process.env.NATS_HOST, waitOnFirstConnect: true }); this.jsm = await this.natsConnection.jetstreamManager(); await this.setupStream(); await this.subscribeToTopics();