There's more...
Messaging is a really large topic. The same concepts we saw in this recipe can be applied also to distributed systems using the Enterprise Message Bus (see https://en.wikipedia.org/wiki/Enterprise_service_bus).
Also, within our program, messaging is a great way to decouple our classes and to make software easier to maintain and improve. Another real-world use case for object types is within the boundaries of a class. Remember that publishing a message is a synchronous process. Your call to SendMessage will not return until each subscriber's MessageListener code is run in turn. Therefore, your publisher will take longer for the SendMessage call to return. Regarding multithreading, consider that TMessageManager is not usable ...
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