Chapter 3. Messaging

In a microservices architecture, services in an application are supposed to be isolated from each other so that they can be developed, hosted, upgraded, and scaled independently. Messaging is an important technique to enable flexible communication patterns among these loosely coupled services. As a distributed runtime, Dapr provides built-in messaging support for developers to design event-driven microservices applications.

Event-Driven Programming

Our world is filled with events—indeed, anything that happens can be considered an event. Collision of stars, eruption of a volcano, turn of a page, blink of an eye; these are all events, with different levels of significance associated with them. Some events, such as a blink, rarely cause any significant reactions. Others, such as natural disasters, most certainly do.

Event-driven programming models how events trigger reactions. It has become the pervasive programming model for GUI programs because it presents a natural way to model human–machine interactions—someone clicks a button, and something happens.

Event-driven programming also works well in systems that comprise loosely coupled components. A component notifies other components that something has happened by raising an event, and the event can be picked up by one or more interested listeners and trigger additional actions.

This chapter and the next introduce how Dapr supports event-driven programming using triggers, bindings, and pub/sub.

Messages Versus ...

Get Learning Dapr now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.