In the preceding example, we used AMQP channels to send simple string messages from publisher to subscriber. In order to use AMQP to build an actual publish/subscribe architecture, we will need to transmit more complex messages with structured data. In general, each AMQP message is simply a string of bytes. To submit structured data, we can use serialization formats, such as JSON or XML. Also, since AMQP is not limited to ASCII messages, we could also use binary serialization protocols such as MessagePack or ProtocolBuffers.
For whichever serialization format you decide, you need to make sure that both publisher and subscriber understand both the serialization format and the actual internal structure of the messages. ...