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 <[email protected]>

* refactor: nats config function

Signed-off-by: bhavanakarwade <[email protected]>

* wip: implemented nats queue functionality

Signed-off-by: bhavanakarwade <[email protected]>

* wip: implemented nats queue functionality

Signed-off-by: bhavanakarwade <[email protected]>

* wip: nats queue configurations

Signed-off-by: bhavanakarwade <[email protected]>

* feat: support nats queue

Signed-off-by: bhavanakarwade <[email protected]>

* fix: add logger

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: added logger

Signed-off-by: bhavanakarwade <[email protected]>

* fix: remove unnecessary logs

Signed-off-by: bhavanakarwade <[email protected]>

* fix: added optional parameter

Signed-off-by: bhavanakarwade <[email protected]>

* feat: implement nats queue

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: added geo-service queue

Signed-off-by: bhavanakarwade <[email protected]>

---------

Signed-off-by: bhavanakarwade <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
  • Loading branch information
bhavanakarwade authored and KulkarniShashank committed Sep 11, 2024
1 parent 3a99d28 commit 3bf3a5e
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 3bf3a5e

Please sign in to comment.