I'm spec'ing a design right now that uses RabbitMQ as a message queue. The message are going to have a JSON body, and for one message in particular I'd like to add a small binary file.
What I'd like to know is, should the binary file's data be part of the JSON message, or can it be appended to the message separately?
Since RabbitMQ message payload is just a binary array you should encode your message body with 3 fields:
I disagree with a previous answer about embedding a file in json. If you encode file data inside of json you will get wasted space because of json escaping + unnecessary CPU usage because of json encoding/decoding of the file data + you will need to read file data twice (once for json deserialization and once more to copy it where it needs to go)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With