NestJS · Middle · Question 44 of 75
What's the difference between @MessagePattern and @EventPattern in Nest microservices?
- 1They are aliases
- ✓Correct answer:
@MessagePatternhandles request-response messages (the caller waits for a reply);@EventPatternhandles fire-and-forget events - 3
@EventPatternworks only over HTTP
Explanation
On the client side, client.send() expects a response and client.emit() publishes an event.