Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microservice Patterns and Best Practices

You're reading from   Microservice Patterns and Best Practices Explore patterns like CQRS and event sourcing to create scalable, maintainable, and testable microservices

Arrow left icon
Product type Paperback
Published in Jan 2018
Publisher Packt
ISBN-13 9781788474030
Length 366 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Vinicius Feitosa Pacheco Vinicius Feitosa Pacheco
Author Profile Icon Vinicius Feitosa Pacheco
Vinicius Feitosa Pacheco
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Understanding the Microservices Concepts 2. The Microservice Tools FREE CHAPTER 3. Internal Patterns 4. Microservice Ecosystem 5. Shared Data Microservice Design Pattern 6. Aggregator Microservice Design Pattern 7. Proxy Microservice Design Pattern 8. Chained Microservice Design Pattern 9. Branch Microservice Design Pattern 10. Asynchronous Messaging Microservice 11. Microservices Working Together 12. Testing Microservices 13. Monitoring Security and Deployment 14. Other Books You May Enjoy

Communication layer and accreditation between services


Currently, the communication between microservices has the following model of calls:

As you can see, we use RPC and PUB/SUB for the internal layer and HTTP calls for calls made in the public-facing layer. At one point in our internal layer, we make use of the HTTP protocol. There is nothing wrong with this, but RPC for calls between microservices is the most efficient, especially if we use some kind of data wrapper, such as binary protocol or some other mechanism for packet reduction.

Let's modify this call to an RPC. However, it will be different from the RPCs we currently have, since we will pass a binary protocol package. For this, we will use the gRPC, creating a server in UsersService and a client in RecommendationService.

This HTTP call that we want to delete is in RecommendationService, in the receiver method of the Recommendation class, inside the service.py file, as you can see here:

    ...
       def receiver(self, data):
   ...
lock icon The rest of the chapter is locked
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 £16.99/month. Cancel anytime