Marko Sami
Marko Sami

Reputation: 1

Encountering PRECONDITION_FAILED Error (Code 406) in RabbitMQ When Sending Large Messages

I'm working on a project where I need to send large messages through RabbitMQ. However, I'm encountering the following error:

I am using NestJs microservices

"err": {     "code": 406,     "classId": 60,     "methodId": 40   }

Context:

What I've Tried:

  1. Adjusting Queue Arguments:

    • Set the x-max-length-bytes argument to 20971520 (20 MB) during queue declaration.

    • Verified that the queue is declared with the correct arguments.

  2. Increasing frame_max:

    • Configured frame_max to a higher value in the RabbitMQ configuration to accommodate larger frames.
  3. Client Configuration:

    • Ensured that the client settings (e.g., socketOptions in Node.js) are configured to handle larger message sizes.

Observations:

Questions:

  1. Is there a maximum message size limit in RabbitMQ that I'm exceeding?

  2. Are there additional configurations or best practices for handling large messages in RabbitMQ?

  3. Could the PRECONDITION_FAILED error be related to other settings or misconfigurations?

Any insights or suggestions would be greatly appreciated. Thank you in advance!

Upvotes: 0

Views: 45

Answers (2)

Marko Sami
Marko Sami

Reputation: 1

I added rabbitmq.conf file with these configs:

max_message_size = 536870912
frame_max = 536870912

and it can now accept larger messages.

Upvotes: 0

guest
guest

Reputation: 1

Increase the frame_max setting to 20 MB (both client and server). Verify no resource limits (e.g., memory or disk quotas) are causing the issue. Consider splitting or compressing the payload if size continues to be an issue. Check RabbitMQ logs for errors beyond the 406 PRECONDITION_FAILED.

Upvotes: 0

Related Questions