Hi guys I'm trying to set a Request/response responder(MessagePattern) on a Microservice with NATS in transport layer. I have a natscli subscribing to the server, and from another natscli I'm sending a request, which autogenerates the reply subject(INBOX...), and it's supposed that returning from nest method should automatically send the response to reply subject, but it's not happening, The natscli which is subscribing the server only records the request.
$ nats request test "{\"msg\": \"testingOK\"}" --timeout=20s
13:21:59 Sending request on "test"
nats.exe: error: nats: timeout, try --help
My method listening is:
@MessagePattern('test')
getNatsReponse(data: string) {
return data;
}
And my config is:
async function bootstrap() {
const app = await NestFactory.createMicroservice<MicroserviceOptions>(
AppModule,
{
transport: Transport.NATS,
options: {
servers: ['nats://nats:4222'],
},
},
);
app.listen();
}
bootstrap();
In docker-compose.yml:
nats:
image: nats
restart: always
ports:
- 4222:4222
networks:
- nestjs-network
Can somebody tell me what am im doing wrong?