Skip to content

Commit

Permalink
Feat/support multiple nats url (#805)
Browse files Browse the repository at this point in the history
* wip: nats configuration

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* refactor: nats config function

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* wip: implemented nats queue functionality

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* wip: implemented nats queue functionality

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* wip: nats queue configurations

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* feat: support nats queue

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* fix: add logger

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* refactor: added logger

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* fix: remove unnecessary logs

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* fix: added optional parameter

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* feat: implement nats queue

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

* refactor: added geo-service queue

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>

---------

Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>
Signed-off-by: KulkarniShashank <shashank.kulkarni@ayanworks.com>
  • Loading branch information
bhavanakarwade authored and KulkarniShashank committed Sep 11, 2024
1 parent d96933a commit bfb8fd6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion apps/api-gateway/src/geo-location/geo-location.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -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
]),
Expand Down
3 changes: 2 additions & 1 deletion apps/geo-location/src/geo-location.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ 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: [
ClientsModule.register([
{
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,
Expand Down
3 changes: 2 additions & 1 deletion apps/geo-location/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
const app = await NestFactory.createMicroservice<MicroserviceOptions>(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());

Expand Down
3 changes: 2 additions & 1 deletion libs/common/src/common.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down

0 comments on commit bfb8fd6

Please sign in to comment.