Question · NestJS course · Module 7: Testing

Acknowledging messages with channel.ack()

What does calling channel.ack(originalMsg) do in a RabbitMQ consumer?

Answer options

  • Confirms successful processing of the message, so the broker removes it from the queue
  • Rejects the message and discards it without a retry
  • Creates a new queue named originalMsg
  • Sends the message back to the producer asking it to resend

You can check the correct answer by solving this task in the CodeWorlds game.