Building an event emitter
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. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access