Microservices Nestjs:如何从客户端处理microservice MessagePattern

Microservices Nestjs:如何从客户端处理microservice MessagePattern,microservices,nestjs,nats.io,Microservices,Nestjs,Nats.io,在我打电话之前,我想检查MessagePattern是否存在,因为当pattern not exist应用程序挂起时 @MessagePattern({ service: 'data', slot: 'authorizeUser'}) @UseFilters(new ExceptionFilter()) authorizeUser(@Payload() payload: Types.IMessagePayload) { return this.appService.author

在我打电话之前,我想检查MessagePattern是否存在,因为当pattern not exist应用程序挂起时

 @MessagePattern({ service: 'data', slot: 'authorizeUser'})
  @UseFilters(new ExceptionFilter())
  authorizeUser(@Payload() payload: Types.IMessagePayload) {
    return this.appService.authorizeUser(payload);
  }
我可以为每个模式设置网关,并通过@nestjs/terminus检查客户端是否存在,但我认为这不是一个好的解决方案

 await this.clientProxy
      .send({ service: 'data', slot: 'findAndPopulate' }, payload)
      .toPromise();
nats chanels或smth还有更好的解决方案吗

@Get('/getSpecificUser/health')
@MessagePattern({ service: 'data', slot: 'getSpecificUser ' })
authorizeUser(@Payload() payload: Types.IMessagePayload) {
   return this.appService.authorizeUser(payload);
}


  // client
_this.health.check([() => _this.dns.pingCheck('group','/getSpecificUser/health')]);