mirror of
https://gitlab.com/mobicoop/v3/service/ad.git
synced 2026-01-11 22:02:39 +00:00
use health package, upgrade ddd library, improve integration tests
This commit is contained in:
1
src/modules/messager/messager.di-tokens.ts
Normal file
1
src/modules/messager/messager.di-tokens.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const MESSAGE_PUBLISHER = Symbol('MESSAGE_PUBLISHER');
|
||||
36
src/modules/messager/messager.module.ts
Normal file
36
src/modules/messager/messager.module.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Module, Provider } from '@nestjs/common';
|
||||
import { MESSAGE_PUBLISHER } from './messager.di-tokens';
|
||||
import {
|
||||
MessageBrokerModule,
|
||||
MessageBrokerModuleOptions,
|
||||
MessageBrokerPublisher,
|
||||
} from '@mobicoop/message-broker-module';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
|
||||
const imports = [
|
||||
MessageBrokerModule.forRootAsync({
|
||||
imports: [ConfigModule],
|
||||
inject: [ConfigService],
|
||||
useFactory: async (
|
||||
configService: ConfigService,
|
||||
): Promise<MessageBrokerModuleOptions> => ({
|
||||
uri: configService.get<string>('MESSAGE_BROKER_URI'),
|
||||
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'),
|
||||
name: 'ad',
|
||||
}),
|
||||
}),
|
||||
];
|
||||
|
||||
const providers: Provider[] = [
|
||||
{
|
||||
provide: MESSAGE_PUBLISHER,
|
||||
useClass: MessageBrokerPublisher,
|
||||
},
|
||||
];
|
||||
|
||||
@Module({
|
||||
imports,
|
||||
providers,
|
||||
exports: [MESSAGE_PUBLISHER],
|
||||
})
|
||||
export class MessagerModule {}
|
||||
Reference in New Issue
Block a user