In this chapter, we started with the definition of microservices. The main difference between a monolithic application and a microservice is the way a tightly coupled architecture is broken into a loosely coupled architecture.
Microservices talk to each other using either REST-based JSON or RPC-based protocol buffers. Using microservices, we can break business logic into multiple chunks. Each service does one job pretty well. Go has a lightweight framework called Go Micro. Using it, we can create services and clients.
We first created an encryption service using Micro go. We then developed a client for consuming the service. Go Micro also allows asynchronous programming by providing a Publish/Subscribe pattern. Any client/service can subscribe or push events to a topic. It uses an HTTP broker by default but can be easily configured to RabbitMQ or Kafka. Go Micro also provides features such as service discovery, and various transport mechanisms such as protocol buffers, JSON, and so on. Small organizations can start with a monolith, but in bigger organizations with huge teams, microservices are better suited.
In the next chapter, we are going to see how to deploy our Go services using nginx. A service needs to be deployed for it to be exposed to the outside world. We also use docker-compose and containers for a clean deployment.