在websockets microservice中嵌套js从rabbitmq读取事件

在websockets microservice中嵌套js从rabbitmq读取事件,websocket,nestjs,Websocket,Nestjs,我已经创建了一个带有rabbitmq连接的微服务(notify microservice)。我在那里有一个产品微服务,我将向rabbitmq推送一个事件,以通知客户有关新产品的信息。在notify microservice micro service中,我有一个websocket。如何从rabbitmq读取事件以通知客户端。 现在我只能从microservice的控制器读取rabbitmq中的事件。如何读取websocket文件 microservice main.ts文件: import {

我已经创建了一个带有rabbitmq连接的微服务(notify microservice)。我在那里有一个产品微服务,我将向rabbitmq推送一个事件,以通知客户有关新产品的信息。在notify microservice micro service中,我有一个websocket。如何从rabbitmq读取事件以通知客户端。 现在我只能从microservice的控制器读取rabbitmq中的事件。如何读取websocket文件

microservice main.ts文件:

import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { Transport } from '@nestjs/microservices';
import { AppModule } from './app.module';


const logger = new Logger('Main');
const microserviceOptions = {
  transport: Transport.RMQ,
  options: {
    urls: ['amqp://<user_name>:<password>@<host>:<port>/<vhost>'],
    queue: '<queue_name>',
    queueOptions: {
      durable: false
    },
  }
}

async function bootstrap() {
  const app = await NestFactory.createMicroservice(AppModule, microserviceOptions);
  app.listen(() => {
    logger.log("Socket micro service is listening...");
  })
}
bootstrap();
notify.controller.ts

import { Body, Controller, Get, Logger, Post } from '@nestjs/common';
import { EventPattern } from '@nestjs/microservices';

@Controller()
export class NotifyController {

  private logger = new Logger('NotifyController');

  @EventPattern('notify_new_product')
  async notify_new_product(product_id: string) {
    
    this.logger.log('Received new event to notify');
  }
}
import { Module } from '@nestjs/common';
import { AppGateway } from './app.gateway';
import { NotifyController } from './notify.controller';
import { ClientsModule, Transport } from '@nestjs/microservices';

@Module({
  imports: [],
  controllers: [NotifyController],
  providers: [AppGateway],
})
export class AppModule {}
import { Body, Controller, Get, Logger, Post } from '@nestjs/common';
import { EventPattern } from '@nestjs/microservices';

@Controller()
export class NotifyController {

  private logger = new Logger('NotifyController');

  @EventPattern('notify_new_product')
  async notify_new_product(product_id: string) {
    
    this.logger.log('Received new event to notify');
  }
}