@MessagePattern({ service: 'data', slot: 'authorizeUser'})
@UseFilters(new ExceptionFilter())
authorizeUser(@Payload() payload: Types.IMessagePayload) {
return this.appService.authorizeUser(payload);
}
在我打电话之前,我想检查MessagePattern的存在,因为当模式不存在时,应用正在挂起
await this.clientProxy
.send({ service: 'data', slot: 'findAndPopulate' }, payload)
.toPromise();
我可以为每个模式设置他的网关,并使用@ nestjs / terminus从客户端检查他的存在,但是我认为这不是一个很好的解决方案
@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')]);
有其他更好的解决方案吗?