Learning about message queue and publisher-subscriber models

Most of the IPC mechanisms provided by POSIX operating systems are quite basic. Their APIs are built using file descriptors and they treat input and output channels as raw sequences of bytes.

Applications, however, tend to use data fragments of specific lengths and purposes for data interchange messages. Despite API mechanisms of operating systems being flexible and generic, they are not always convenient for message exchange. That is why dedicated libraries and components were built on top of default IPC mechanisms to simplify the message exchange mode.

In this recipe, we will learn how to implement an asynchronous data exchange between two applications using the publisher-subscriber (pub-sub) model.

The model is easy to understand and widely used for the development of software systems designed as collections of independent, loosely coupled components communicating with each other. The isolation of functions and asynchronous data exchange allows us to build flexible, scalable, and robust solutions. 

In the pub-sub model, applications act as publishers, subscribers, or both. Instead of sending requests to particular applications and expecting them to respond, an application can publish a message to a specific topic or subscribe to receive messages on a topic it is interested in. When publishing a message, the application does not care how many subscribers are listening to the topic. Similarly, a subscriber does not know which application is going to send a message on a particular topic or when to expect it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.130.24