I'm new to @nestjs/microservices, and running into a weird issue.
I have a setup of two apps written in Nest and checking the micro-service connection between them. For some strange reason, clientProxy.emit / @EventPattern
works - but clientProxy.send / @MessagePattern
is not. I've double checked the connection, it works fine. But the request/response approach does not work for me.
Any help would be greatly appreciated.. Sending the request is as follows:
this.shortenerService
.send('create', {
url: 'test',
});
Receiving:
@UsePipes(new ValidationPipe())
@MessagePattern('create')
async create(@Payload() data: CreateDto): Promise<string> {
return Promise.resolve(`${Math.random()}`);
}
Tried to change to .emit
in client and @EventPattern
in server - and it works. But not for request/response.
Tried to organize into a minimal repository