有没有办法通过发布/订阅模式使用 NestJS 微服务?例如使用 amqp?据我了解,每个“微服务类型”都遵循请求/响应模式。
最佳答案
@EventPattern('user_created')
async handleUserCreated(data: Record<string, unknown>) {
// business logic
}
async publish() {
this.client.emit<number>('user_created', new UserCreatedEvent());
}
关于node.js - NestJS - 微服务中的发布/订阅模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54280458/