Reader small image

You're reading from  Building Microservices with .NET Core

Product typeBook
Published inJun 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781785887833
Edition1st Edition
Languages
Right arrow
Authors (3):
Gaurav Aroraa
Gaurav Aroraa
author image
Gaurav Aroraa

Gaurav Aroraa has done M.Phil in computer science. He is a Microsoft MVP, life time member of Computer Society of India (CSI), certified as a scrum trainer/coach, XEN for ITIL-F and APMG for PRINCE-F and PRINCE-P. Gaurav serves as a mentor at IndiaMentor, open source developer, contributor to TechNet Wiki co-founder of Innatus Curo Software LLC. In 19+ years of his career, he has mentored thousands of students and industry professionals. You can tweet Gaurav on his twitter handle @g_arora
Read more about Gaurav Aroraa

Lalit Kale
Lalit Kale
author image
Lalit Kale

Lalit Kale is a technical architect and consultant with more than 12 years of industry experience. Lalit has helped clients achieve tangible business outcomes through the implementation of best practices in software development. He is a practitioner of TDD and DDD, and a big believer in agile and lean methodologies. He has worked with several organizations, from start-ups to large enterprises, in making their systems successful, be it in-house or mission critical, with clients in the USA, the UK, Germany, Ireland, and India. His current interests include container technologies and machine learning using Python. He holds a bachelor's degree in engineering (IT).
Read more about Lalit Kale

Manish Kanwar
Manish Kanwar
author image
Manish Kanwar

Manish Kanwar completed his masters of science in computer applications from MD University, India, and is a cofounder of Innatus Curo Software LLC, with a presence in India. He has been working in the IT industry across domains for the last 17 years. He started exploring .NET right from the first release and has been glued to it ever since. His range of experience includes global wealth management (financial service industry, USA), life insurance (insurance industry, USA), and document management system (DMS), ECMS, India. Manish does his bit for the community by helping young professionals through the IndiaMentor platform.
Read more about Manish Kanwar

View More author details
Right arrow

Chapter 3. Integration Techniques

In the previous chapter, we developed microservices using a .NET monolithic application. These services are independent of each other and are located on different servers. What would be a better way to have inter-service communication, where one service interacts/communicates with the other? In this chapter, we will discuss the various patterns and ways that will help us foster this communication. We will cover the following topics:

  • Communication between services
  • Styles of collaborations
  • Integration patterns
  • The API gateway
  • The event-driven pattern
  • Azure Service Bus

Communication between services


In the case of a .NET monolithic application, if there is a need to access third-party components or external services, we use the HTTP client or another client framework to access the resources. In Chapter 2, Building Microservices, we developed Product service in such a way that it would work independently. But this was not the case; we mandatorily required a few services to interact with each other. So this is a challenge: having services communicate with each other. Both Product service and Order service are hosted on separate servers. Both these servers are independent of each other, are based on REST, and have their own endpoints via which they communicate with each other (when a service interacts with another service and vice versa, we refer to it as inter-service communication as well).

There are ways in which services communicate with each other; let's discuss them briefly:

  • Synchronous: In this, the client makes a request to the remote service (called...

Integration patterns


Until now, we have discussed inter-service communication and have gone through the practical implementation of Product service with the use of synchronous and asynchronous communication. We've also implemented microservices using different styles of collaborations. Our FlixOne bookstore (developed as per the microservice architectural style) required more interaction; therefore, it required more patterns. In this section, we will discuss the implementation of various integration patterns required for our application.

Note

The complete application of the FlixOne bookstore is available in Chapter 10, Creating a Complete Microservice Solution.

The API gateway

In the styles of collaboration section, we discussed two styles using which we can foster intercommunication between microservices. Our application is spread into various microservices:

  • Product service
  • Order service
  • Invoice service
  • Customer service

In our FlixOne bookstore (user interface), we need to show a few details:

  • Book...

Summary


Inter-service communication is possible with synchronous or asynchronous communication, which are styles of collaborations. Microservices should have asynchronous APIs. The API gateway is a proxy server that provides a way to interact various clients with APIs. API management, as an API gateway, provides plenty of features to manage/host various RESTful APIs. There are various patterns that help us communicate with microservices. With the use of Azure Bus Service, we can easily manage and play with inter-service communication using the Azure Bus Service message queue; services can easily send or receive messages from each other through this. Eventual consistency talks about scalable systems with high scalability, and it is proven with the CAP theorem. 

In the next chapter, we will discuss various testing strategies to test an application and build on the microservice architectural style.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Building Microservices with .NET Core
Published in: Jun 2017Publisher: PacktISBN-13: 9781785887833
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.
undefined
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 $15.99/month. Cancel anytime

Authors (3)

author image
Gaurav Aroraa

Gaurav Aroraa has done M.Phil in computer science. He is a Microsoft MVP, life time member of Computer Society of India (CSI), certified as a scrum trainer/coach, XEN for ITIL-F and APMG for PRINCE-F and PRINCE-P. Gaurav serves as a mentor at IndiaMentor, open source developer, contributor to TechNet Wiki co-founder of Innatus Curo Software LLC. In 19+ years of his career, he has mentored thousands of students and industry professionals. You can tweet Gaurav on his twitter handle @g_arora
Read more about Gaurav Aroraa

author image
Lalit Kale

Lalit Kale is a technical architect and consultant with more than 12 years of industry experience. Lalit has helped clients achieve tangible business outcomes through the implementation of best practices in software development. He is a practitioner of TDD and DDD, and a big believer in agile and lean methodologies. He has worked with several organizations, from start-ups to large enterprises, in making their systems successful, be it in-house or mission critical, with clients in the USA, the UK, Germany, Ireland, and India. His current interests include container technologies and machine learning using Python. He holds a bachelor's degree in engineering (IT).
Read more about Lalit Kale

author image
Manish Kanwar

Manish Kanwar completed his masters of science in computer applications from MD University, India, and is a cofounder of Innatus Curo Software LLC, with a presence in India. He has been working in the IT industry across domains for the last 17 years. He started exploring .NET right from the first release and has been glued to it ever since. His range of experience includes global wealth management (financial service industry, USA), life insurance (insurance industry, USA), and document management system (DMS), ECMS, India. Manish does his bit for the community by helping young professionals through the IndiaMentor platform.
Read more about Manish Kanwar