The maximum size of a message in RabbitMQ is not defined by the protocol, but by the implementation. Unfortunately, this value is not well documented and has changed a lot over the years. We made this short article to summarize the current state of affairs.
max_message_size configuration option. See GitHub thread.Note that because a version supports a given message size limit does not mean that it is fine to approach it. In practice, it is recommended to keep messages small and way bellow the limit (a few MiB) to avoid performance issues and memory consumption problems. See how to reduce messages size bellow.
Typically, when encoding a string in UTF8, each ASCII character takes a single byte, so in version 4.0, the maximum number of characters in a message is 16,777,216 characters. However, some non-ASCII characters take more space, for instance accents or emojis. In this case, the maximum number of characters in a message can be lower since some characters take up more space.
The RabbitMQ management plugin has a limitation that prevents it from displaying messages larger than 50,000 characters (messages are truncated). If you need to read / consume larger messages, you can use RabbitGUI instead, which does not have this limitation.
It is usually not a good idea to send large messages in RabbitMQ, a simple way to reduce this is to store the payload in a database or an object storage service (like S3) and send a reference to it in the message, like an ID. This way, you can keep the message size small while still being able to access the full payload when needed.
This approach has the added benefit of allowing you to store large payloads in a more efficient way, as databases and object storage services are designed to handle large files and can provide better performance and scalability.
RabbitMQ tutorialProperly setting up dead-letter queues in RabbitMQLearn how to set up dead-letter queues in RabbitMQ, including creating a dead-letter exchange, binding it to a queue, and managing rejected messages via policies
RabbitMQ tutorialRabbitMQ default login and passwordA quick guide on how to connect to RabbitMQ with the default credentials and how to use RabbitGUI to manage your RabbitMQ instances.
RabbitMQ tutorialRabbitMQ Retry Pattern: How to Retry Failed MessagesLearn how to implement message retry patterns in RabbitMQ using dead-letter queues, delayed retries with TTL, and exponential backoff strategies.Debug, monitor, and manage RabbitMQ with a modern developer interface.
Try now
ProductHow to visually explore RabbitMQ queue bindingsThere are many ways messages can be routed to queues in RabbitMQ, and it can be hard to understand how they are connected in a single place
Cheat sheetRabbitMQ PHP Cheat-SheetEverything you need to know to get started with RabbitMQ in PHP and Docker with code examples ready to go.
ProductDebugging policies in RabbitMQWhile rules regarding which policies are applied to which queues are simple, visually understanding what is going on when something does not behave as expected might be tricky