diff --git a/src/modules/configuration/adapters/primaries/configuration-messager.controller.ts b/src/modules/configuration/adapters/primaries/configuration-messager.controller.ts index 82796d2..c9408ca 100644 --- a/src/modules/configuration/adapters/primaries/configuration-messager.controller.ts +++ b/src/modules/configuration/adapters/primaries/configuration-messager.controller.ts @@ -16,9 +16,7 @@ export class ConfigurationMessagerController { ) {} @RabbitSubscribe({ - exchange: 'configuration', - routingKey: ['create', 'update'], - queue: 'user-configuration-update', + name: 'setConfiguration', }) public async setConfigurationHandler(message: string) { const configuration: Configuration = JSON.parse(message); @@ -38,9 +36,7 @@ export class ConfigurationMessagerController { } @RabbitSubscribe({ - exchange: 'configuration', - routingKey: 'delete', - queue: 'user-configuration-delete', + name: 'deleteConfiguration', }) public async configurationDeletedHandler(message: string) { const deletedConfiguration: Configuration = JSON.parse(message); @@ -58,9 +54,7 @@ export class ConfigurationMessagerController { } @RabbitSubscribe({ - exchange: 'configuration', - routingKey: 'propagate', - queue: 'user-configuration-propagate', + name: 'propagateConfiguration', }) public async propagateConfigurationsHandler(message: string) { const configurations: Array = JSON.parse(message); diff --git a/src/modules/configuration/configuration.module.ts b/src/modules/configuration/configuration.module.ts index 52415ee..2cc0957 100644 --- a/src/modules/configuration/configuration.module.ts +++ b/src/modules/configuration/configuration.module.ts @@ -32,10 +32,24 @@ import { SetConfigurationUseCase } from './domain/usecases/set-configuration.use ): Promise => ({ exchanges: [ { - name: 'configuration', + name: configService.get('RMQ_EXCHANGE'), type: 'topic', }, ], + handlers: { + setConfiguration: { + exchange: configService.get('RMQ_EXCHANGE'), + routingKey: ['configuration.create', 'configuration.update'], + }, + deleteConfiguration: { + exchange: configService.get('RMQ_EXCHANGE'), + routingKey: 'configuration.delete', + }, + propagateConfiguration: { + exchange: configService.get('RMQ_EXCHANGE'), + routingKey: 'configuration.propagate', + }, + }, uri: configService.get('RMQ_URI'), connectionInitOptions: { wait: false }, enableControllerDiscovery: true,