avatarLeon

Summary

The article provides a guide on building a simple event-driven system using Python and Google Pub/Sub, emphasizing its versatility and power when combined with GraphQL.

Abstract

The article titled "What is the Event-driven Architecture that people are talking about?" delves into the concept of event-driven architecture, which centralizes input/output data delivery into channels referred to as events. The author, who has experience working at their company, offers a tutorial on creating a basic event-driven system with Python and Google Pub/Sub, claiming that the system can be production-ready in just three minutes. The system is composed of three main components: Consumer, Producer, and Core. Consumer classes handle the retrieval of messages from event channels or system files, while Producer classes publish messages to the event channel after processing. The Core classes are responsible for the business logic of the project. The article concludes with the successful integration of these components in a main.py file and encourages readers to support the author through Patreon or a Medium membership.

Opinions

  • The author believes that event-driven systems are extremely versatile and powerful, especially when used with GraphQL.
  • The author is confident in the efficiency of their design, promising a production-ready system in a short amount of time.
  • The author values the focus on delivering core business values over the technicalities of data transfer.
  • The author suggests that their tutorial is accessible and easy to follow, suitable for readers who wish to quickly implement an event-driven system.
  • The author seeks recognition and support for their work, inviting readers to clap, follow, and consider becoming a patron or Medium member.

What is the Event-driven Architecture that people are talking about?

Event-driven architecture has been a hot topic for backend and system developers in recent years. Instead of designing a service that has input and output coming in and out from different places, we centralize the I/O data delivery into channels. We call those data the event.

In my opinion, the event-driven system is extremely versatile. When using it along with GraphQL, you just have two of the most powerful tools for data delivery. It helps us stop thinking about how to transfer data efficiently, but instead focus that energy on delivering core business values.

Today, I am gonna show you how to quickly build a simple event-driven system with Python and Google Pub/Sub that I design myself from my experience working at my company. I promise it only takes you 3 mins to have an almost production-ready system. You could also find my source code at:

https://github.com/leon-to/event-driven-system

Typically, my system consists of 3 main components: Consumer, Producer, and Core. I will go over each of them and explain what they do in detail.

Consumer

Consumer classes pull any messages from the event channel or generate events from system files.

Producer

Producer classes publish messages to the event channel after being processed by the core system or write to system files or printers.

Core

Core classes are the most important classes in the project. They take care of business logic.

Integration

Now, we put everything together in main.py and run it.

Here is the result from the terminal and Google Pub/Sub.

Terminal

Pub/Sub:

Congratulations! You just successfully built your first event-driven system. I hope you enjoy this small exercise.

To conclude, the event-driven system is a fantastic architecture to have in your arsenal. If you like my content, please don’t forget to give me claps and follow me to my next post. Also, consider supporting me via:

Event Driven Architecture
Google
React
Backend
Amazon
Recommended from ReadMedium