@MessagePattern is request-response and its return value goes back to the caller; @EventPattern is fire-and-forget with no response@MessagePattern is request-response. Its handler pairs with client.send(), and the caller waits for the returned value. @EventPattern is fire-and-forget. It pairs with client.emit(), and the publisher doesn't expect a reply.
"@MessagePattern is for TCP only; @EventPattern is for Kafka only" is wrong: both work across transports. "@MessagePattern broadcasts to all instances" is also wrong. Whether a message goes to one instance or all of them depends on the broker, not the decorator.
Read more
- Microservices (https://docs.nestjs.com/microservices/basics)docs.nestjs.com