From 86b6aa2c953847b1e4710eabd7a3841466c2b8ff Mon Sep 17 00:00:00 2001 From: diy0r Date: Sat, 6 Jul 2024 22:17:35 +0500 Subject: [PATCH] feat: determine SerDes object --- lib/rmq-core.module.ts | 10 ++++++++-- lib/rmq.module.ts | 9 ++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/rmq-core.module.ts b/lib/rmq-core.module.ts index 652012d..50af0be 100644 --- a/lib/rmq-core.module.ts +++ b/lib/rmq-core.module.ts @@ -21,7 +21,10 @@ export class RmqNestjsCoreModule { providers: [ { provide: RMQ_CONNECT_OPTIONS, useValue: configOptions }, { provide: RMQ_APP_OPTIONS, useValue: globalOptions || {} }, - { provide: SERDES, useValue: serDes }, + { + provide: SERDES, + useValue: globalOptions.globalBroker.serDes ?? serDes, + }, RmqNestjsConnectService, RmqGlobalService, ], @@ -43,7 +46,10 @@ export class RmqNestjsCoreModule { inject: configOptions.inject || [], }, { provide: RMQ_APP_OPTIONS, useValue: globalOptions || {} }, - { provide: SERDES, useValue: serDes }, + { + provide: SERDES, + useValue: globalOptions.globalBroker.serDes ?? serDes, + }, RmqNestjsConnectService, RmqGlobalService, ], diff --git a/lib/rmq.module.ts b/lib/rmq.module.ts index 948dc0a..5213f68 100644 --- a/lib/rmq.module.ts +++ b/lib/rmq.module.ts @@ -6,12 +6,7 @@ import { IRabbitMQConfig, IGlobalOptions, } from './interfaces'; -import { - MODULE_TOKEN, - RMQ_BROKER_OPTIONS, - SERDES, - TARGET_MODULE, -} from './constants'; +import { MODULE_TOKEN, RMQ_BROKER_OPTIONS, SERDES } from './constants'; import { DiscoveryModule } from '@nestjs/core'; import { MetaTegsScannerService, getUniqId } from './common'; import { RmqNestjsCoreModule } from './rmq-core.module'; @@ -43,7 +38,7 @@ export class RmqNestjsModule { imports: [DiscoveryModule], providers: [ { provide: RMQ_BROKER_OPTIONS, useValue: options }, - { provide: SERDES, useValue: serDes }, + { provide: SERDES, useValue: options.serDes ?? serDes }, { provide: MODULE_TOKEN, useFactory: getUniqId }, RmqService, MetaTegsScannerService,