From 0ba79500e4f984cf2639126ded27728475614082 Mon Sep 17 00:00:00 2001 From: bhavanakarwade <137506897+bhavanakarwade@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:40:05 +0530 Subject: [PATCH] Feat/support multiple nats url (#805) * wip: nats configuration Signed-off-by: bhavanakarwade * refactor: nats config function Signed-off-by: bhavanakarwade * wip: implemented nats queue functionality Signed-off-by: bhavanakarwade * wip: implemented nats queue functionality Signed-off-by: bhavanakarwade * wip: nats queue configurations Signed-off-by: bhavanakarwade * feat: support nats queue Signed-off-by: bhavanakarwade * fix: add logger Signed-off-by: bhavanakarwade * refactor: added logger Signed-off-by: bhavanakarwade * fix: remove unnecessary logs Signed-off-by: bhavanakarwade * fix: added optional parameter Signed-off-by: bhavanakarwade * feat: implement nats queue Signed-off-by: bhavanakarwade * refactor: added geo-service queue Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade Signed-off-by: KulkarniShashank --- apps/api-gateway/src/geo-location/geo-location.module.ts | 3 ++- apps/geo-location/src/geo-location.module.ts | 3 ++- apps/geo-location/src/main.ts | 3 ++- libs/common/src/common.constant.ts | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/api-gateway/src/geo-location/geo-location.module.ts b/apps/api-gateway/src/geo-location/geo-location.module.ts index 7a196c408..cf99b11e6 100644 --- a/apps/api-gateway/src/geo-location/geo-location.module.ts +++ b/apps/api-gateway/src/geo-location/geo-location.module.ts @@ -8,6 +8,7 @@ import { getNatsOptions } from '@credebl/common/nats.config'; import { CommonModule } from '@credebl/common'; import { RateLimiterModule, RateLimiterGuard } from 'nestjs-rate-limiter'; import { APP_GUARD } from '@nestjs/core'; +import { CommonConstants } from '@credebl/common/common.constant'; @Module({ imports: [ @@ -17,7 +18,7 @@ import { APP_GUARD } from '@nestjs/core'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions(process.env.API_GATEWAY_NKEY_SEED) + options: getNatsOptions(CommonConstants.GEO_LOCATION_SERVICE, process.env.API_GATEWAY_NKEY_SEED) }, CommonModule ]), diff --git a/apps/geo-location/src/geo-location.module.ts b/apps/geo-location/src/geo-location.module.ts index c4c8a8e5b..4fc8e2679 100644 --- a/apps/geo-location/src/geo-location.module.ts +++ b/apps/geo-location/src/geo-location.module.ts @@ -7,6 +7,7 @@ import { CacheModule } from '@nestjs/cache-manager'; import { getNatsOptions } from '@credebl/common/nats.config'; import { PrismaService } from '@credebl/prisma-service'; import { GeoLocationRepository } from './geo-location.repository'; +import { CommonConstants } from '@credebl/common/common.constant'; @Module({ imports: [ @@ -14,7 +15,7 @@ import { GeoLocationRepository } from './geo-location.repository'; { name: 'NATS_CLIENT', transport: Transport.NATS, - options: getNatsOptions(process.env.GEOLOCATION_NKEY_SEED) + options: getNatsOptions(CommonConstants.GEO_LOCATION_SERVICE, process.env.GEOLOCATION_NKEY_SEED) } ]), CommonModule, diff --git a/apps/geo-location/src/main.ts b/apps/geo-location/src/main.ts index 914183ae2..4534d7cf9 100644 --- a/apps/geo-location/src/main.ts +++ b/apps/geo-location/src/main.ts @@ -4,13 +4,14 @@ import { NestFactory } from '@nestjs/core'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import { getNatsOptions } from '@credebl/common/nats.config'; import { GeoLocationModule } from './geo-location.module'; +import { CommonConstants } from '@credebl/common/common.constant'; const logger = new Logger(); async function bootstrap(): Promise { const app = await NestFactory.createMicroservice(GeoLocationModule, { transport: Transport.NATS, - options: getNatsOptions(process.env.GEOLOCATION_NKEY_SEED) + options: getNatsOptions(CommonConstants.GEO_LOCATION_SERVICE, process.env.GEOLOCATION_NKEY_SEED) }); app.useGlobalFilters(new HttpExceptionFilter()); diff --git a/libs/common/src/common.constant.ts b/libs/common/src/common.constant.ts index 37a898c08..ea771fae9 100644 --- a/libs/common/src/common.constant.ts +++ b/libs/common/src/common.constant.ts @@ -338,7 +338,8 @@ ISSUANCE_SERVICE = 'issuance', VERIFICATION_SERVICE = 'verification', ECOSYSTEM_SERVICE = 'ecosystem', WEBHOOK_SERVICE = 'webhook', -NOTIFICATION_SERVICE = 'notification' +NOTIFICATION_SERVICE = 'notification', +GEO_LOCATION_SERVICE = 'geo-location' } export const postgresqlErrorCodes = [];