I'm trying to connect to a Rabbit MQ docker container using NestJS microservice. I'm running it using vagrant. This is the error I'm getting:
[1601171008162] ERROR (32761 on local): Disconnected from RMQ. Trying to reconnect.
context: "Server"
trace: ""
[1601171008163] ERROR (32761 on local):
context: "Server"
trace: ""
msg: {
"err": {
"cause": {},
"isOperational": true
}
}
This is the server config.
{
transport: Transport.RMQ,
options: {
urls: ['amp://username:[email protected]:5672'],
queue: 'test_queue',
queueOptions: {
durable: true
},
noAck: true,
prefetchCount: 1
}
}
I've been trying to figure this out for over a week. Any help would be appreciated.
I had this error, it was solved by just setting in the microservice configuration the noAck: false, and prefetchCount: 1.
Here is an example of the configuration:
The explanation is:
In the nestjs documentation, a basic configuration is presented, where noAck is not defined, and then the example of how to consume the queue message is presented, but in the example itself, the manual ack is done, however, as in the configuration it was not when noAck:false is set, the error mentioned above is generated, because at the time of doing the manual Ack, the message no longer existed.