17 lines
607 B
TypeScript
17 lines
607 B
TypeScript
import { Inject, Injectable } from '@nestjs/common';
|
|
import { IPublishMessage } from '../../../../interfaces/message-publisher';
|
|
import { MESSAGE_BROKER_PUBLISHER } from '../../../../app.constants';
|
|
import { MessageBrokerPublisher } from '@mobicoop/message-broker-module';
|
|
|
|
@Injectable()
|
|
export class MessagePublisher implements IPublishMessage {
|
|
constructor(
|
|
@Inject(MESSAGE_BROKER_PUBLISHER)
|
|
private readonly messageBrokerPublisher: MessageBrokerPublisher,
|
|
) {}
|
|
|
|
publish = (routingKey: string, message: string): void => {
|
|
this.messageBrokerPublisher.publish(routingKey, message);
|
|
};
|
|
}
|