Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Designing Microservices Platforms with NATS

You're reading from  Designing Microservices Platforms with NATS

Product type Book
Published in Nov 2021
Publisher Packt
ISBN-13 9781801072212
Pages 356 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Chanaka Fernando Chanaka Fernando
Profile icon Chanaka Fernando

Table of Contents (15) Chapters

Preface 1. Section 1: The Basics of Microservices Architecture and NATS
2. Chapter 1: Introduction to the Microservice Architecture 3. Chapter 2: Why Is Messaging Important in the Microservice Architecture? 4. Chapter 3: What Is NATS Messaging? 5. Section 2: Building Microservices with NATS
6. Chapter 4: How to Use NATS in a Microservice Architecture 7. Chapter 5: Designing a Microservice Architecture with NATS 8. Chapter 6: A Practical Example of Microservices with NATS 9. Chapter 7: Securing a Microservices Architecture with NATS 10. Chapter 8: Observability with NATS in a Microservices Architecture 11. Section 3: Best Practices and Future Developments
12. Chapter 9: How Microservices and NATS Coexist with Integration Platforms 13. Chapter 10: Future of the Microservice Architecture and NATS 14. Other Books You May Enjoy

Chapter 2: Why Is Messaging Important in the Microservice Architecture?

The microservice architecture operates in a decentralized manner where each function is executed by an independent microservice. At the same time, the success of the overall solution depends on the success of each service, as well as the collaboration among services. This demands a proper messaging framework to handle inter-service communication. Messaging is a method of communication between software components or applications. In a typical enterprise platform, there are two main flows of traffic, namely North-South traffic and East-West traffic. The North-South traffic represents the communication coming in and going out of a data center from external systems. In the context of microservices, we can replace the data center with a microservice-based platform. The East-West traffic represents the communication within the data center. For microservices, we can define East-West traffic as the communication within...

Messaging patterns used in distributed systems

As we saw in the previous chapter, distributed system designers use different networking topologies to interconnect systems, and most of those topologies are still used heavily in the technology industry. Network topology defines the layout of communication within the platform and the actual communication pattern; the protocols are not well defined there. In this chapter, we will discuss the communication that occurs within a distributed system.

Distributed system designers have produced different approaches to communicating between systems. These patterns include the following:

  • Remote procedure calls (RPC) versus shared resources
  • Synchronous versus asynchronous (client-server versus pub-sub)
  • Orchestration versus choreography

Let's look at the preceding approaches in more detail so that we can use them when designing communication patterns for a microservice architecture, which is another distributed system...

Communication requirements of a microservice architecture

The microservice architecture is a distributed system. The communication from and to these individual services plays a pivotal role in the overall design and implementation of the platform. Before discussing any particular messaging model for the microservice architecture, let's try to understand the communication requirements of a microservice architecture.

Let's start with the example use case we discussed in the previous chapter, where we started designing a solution for a hospital outward patient division (OPD) using the microservice architecture. Four major functional units operate within the OPD, and each of these functional units can operate independently while communicating with each other. In addition to the functional unit-based definitions of microservices, we also derived two additional microservices for authentication and data sharing, as depicted in the following diagram:

Figure...

Common messaging technologies used in a microservice architecture

We discussed how message brokers can be used in a microservice architecture for East-West traffic in the preceding section. At the same time, we discussed how a synchronous communication model can be utilized for North-South traffic. We will explore some of the popular approaches that are used in the industry for both North-South and East-West traffic in detail in this section.

North-South traffic

In a typical enterprise platform, North-South traffic is the more sensitive and customer-facing communication flow that attracts the maximum attention from everyone. At the same time, it has a direct impact on the business. Since this message flow happens between a human user and a system, a synchronous communication model is used in most cases. Certain requirements need to be met when selecting a technology for North-South communication. This includes the following:

  • Security: Make sure only authorized people...

Summary

In this chapter, we discussed the importance of messaging within a distributed system and how it relates to the success of the platform. We started by identifying different messaging models used in distributed systems and discussed these models in detail. Then, we dived into the OPD example that we discussed in the previous chapter and identified some common messaging requirements of a microservice architecture.

We covered two types of communication flows within a microservice architecture and discussed how each type can be implemented with the technologies available on the market. Understanding messaging-based communication helps developers and architects choose the best technology and method when building real-world enterprise platforms.

We'll discuss the NATS messaging framework in detail in the next chapter and cover various concepts, examples, and use cases surrounding this topic.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Designing Microservices Platforms with NATS
Published in: Nov 2021 Publisher: Packt ISBN-13: 9781801072212
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}