Chapter 3. Messages

 

This chapter covers

  • Using messages as the key to designing microservice architectures
  • Deciding when to go synchronous, and when to go asynchronous
  • Pattern matching and transport independence
  • Examining patterns for microservice message interactions
  • Understanding failure modes of microservice interactions

The term microservices invites you to think in terms of services. You’ll naturally be drawn to ask, “What are the microservices in this system?” Resist that temptation. Microservice systems are powerful because they allow you to think in terms of messages. If you take a messages-first approach to your system design, you free yourself from premature implementation decisions. The intended behavior of the system can be described in terms of a language of messages, independent of the underlying microservices that generate and react to those messages.

3.1. Messages are first-class citizens

A messages-first approach is more useful than a services-first approach to system design. Messages are a direct expression of intent. Business requirements are expressed as the activities that should happen in the system. Strangely, we’re traditionally taught to extract the nouns from business requirements, so that we can build objects. Are business requirements that obscure? Perhaps we should pay more attention to the activities they describe.

3.2. Case study: Sales tax rules

3.3. Pattern matching

3.4. Transport independence

3.5. Message patterns

3.6. When messages go bad

3.7. Summary

sitemap