Skip to content

Commit

Permalink
feat: determine SerDes object
Browse files Browse the repository at this point in the history
  • Loading branch information
DIY0R committed Jul 6, 2024
1 parent 1f06cf9 commit 86b6aa2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 8 additions & 2 deletions lib/rmq-core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
Expand All @@ -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,
],
Expand Down
9 changes: 2 additions & 7 deletions lib/rmq.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 86b6aa2

Please sign in to comment.