官术网_书友最值得收藏!

Asynchronous Microservice Architectures Using Message Queues

In the past two chapters, you learned how to build REST-based microservices with the Go programming language. The REST architectural style is both simple and flexible at the same time, which makes it an excellent choice for many use cases. However, being built on top of HTTP, all communication in a REST architecture will follow the client/server model with request/reply transactions. In some use cases, this might be restrictive and other communication models might be better suited.

In this chapter, we will introduce the publish/subscribe communication model, along with the technologies that you need to implement it. Typically, publish/subscribe architectures require a central infrastructure component—the message broker. In the open source world, there are many different implementations of message brokers; so, in this chapter, we will introduce two different message brokers that we feel to be among the most important ones—RabbitMQ and Apache Kafka. Both are suited for specific use cases; you will learn how to set up each of these two message brokers, how to connect your Go application, and when you should use one or the other.

We will then show you how to use this knowledge in order to extend the event management microservice that you have worked in the previous chapters to publish an event whenever something important happens. This allows us to implement a second microservice that listens on those events. You will also learn about advanced architectural patterns that usually work well alongside asynchronous communication, such as event collaboration and event sourcing, and how (and when) to use them in your application.

In this chapter, we will cover the following topics:

  • The publish/subscribe architectural pattern
  • Event collaboration
  • Event sourcing
  • AMQP with RabbitMQ
  • Apache Kafka
主站蜘蛛池模板: 县级市| 安吉县| 遵化市| 漳平市| 洪雅县| 余姚市| 武宣县| 屏东县| 天台县| 增城市| 台北市| 宁武县| 鞍山市| 三穗县| 萨迦县| 康定县| 晋江市| 隆林| 庄河市| 沂水县| 西平县| 丰台区| 贵州省| 滨海县| 军事| 瑞丽市| 望奎县| 疏勒县| 黎川县| 观塘区| 临朐县| 信宜市| 宽甸| 北川| 启东市| 特克斯县| 阿图什市| 顺义区| 华坪县| 息烽县| 博罗县|