Stack | Event-Driven Architecture in Golang | E-Book | www.sack.de
E-Book

E-Book, Englisch, 384 Seiten

Stack Event-Driven Architecture in Golang

Building complex systems with asynchronicity and eventual consistency
1. Auflage 2024
ISBN: 978-1-80323-218-8
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection

Building complex systems with asynchronicity and eventual consistency

E-Book, Englisch, 384 Seiten

ISBN: 978-1-80323-218-8
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection



Event-driven architecture in Golang is an approach used to develop applications that shares state changes asynchronously, internally, and externally using messages. EDA applications are better suited at handling situations that need to scale up quickly and the chances of individual component failures are less likely to bring your system crashing down. This is why EDA is a great thing to learn and this book is designed to get you started with the help of step-by-step explanations of essential concepts, practical examples, and more.
You'll begin building event-driven microservices, including patterns to handle data consistency and resiliency. Not only will you learn the patterns behind event-driven microservices but also how to communicate using asynchronous messaging with event streams. You'll then build an application made of several microservices that communicates using both choreographed and orchestrated messaging.
By the end of this book, you'll be able to build and deploy your own event-driven microservices using asynchronous communication.

Stack Event-Driven Architecture in Golang jetzt bestellen!

Autoren/Hrsg.


Weitere Infos & Material


Table of Contents - Introduction to Event-Driven Architectures
- Supporting Patterns In Brief
- Design and Planning
- Event Foundations
- Tracking Changes with Event Sourcing
- Asynchronous Connections
- Event-carried State Transfer
- Event Workflows
- Transactional Messaging
- Testing
- Deploying applications to the cloud
- Monitoring and Observability


Preface


Companies are adopting event-driven architecture (EDA) as their web applications grow in size and complexity. Applications that communicate using events are easier to develop and scale. Adding or developing your application around real-time interactions becomes easier with EDA.

Direct point-to-point communication between microservices inevitably leads to the development of a distributed monolith, which is just a monolith with extra and unnecessary complexity. EDA is an architecture that helps organizations to decouple microservices and avoid developing another distributed monolith.

Choosing a new architecture for your next application or deciding to refactor an existing one can be fraught with known and unknown challenges. It is my intention and this book’s goal to provide you with enough examples and knowledge to give you a great head start should you decide to take the development of an EDA.

In this book, we will discuss and cover EDA concepts and related topics with the help of a small modular monolith demonstration application. We will use this application to take a journey through the concepts and topics to convert the synchronous mechanisms used by the application into asynchronous communication mechanisms.

Who this book is for


This architecture book is for developers working with microservices, or those architecting and designing new applications that will be built with microservices. Intermediate-level knowledge of Go is required to make the most of the examples and concepts in this book. Developers with a background in any programming language and experience working with microservices should still find the concepts and explanations useful.

What this book covers


, , introduces EDA.

, , covers helpful patterns such as domain-driven design, domain-centric architectures, and application architectures.

, , explores the ways to discover the capabilities and features of an application using EventStorming and other methods.

, , introduces the Mallbots modular monolith application and domain events.

, , introduces event sourcing and leads you through the development of event-sourced aggregates.

, , covers adding asynchronous communication using event messages.

, , expands on the use of message-based communication between components.

, , covers the concept of distributed transactions and introduces orchestrated sagas.

, , explores the use of message inboxes and outboxes to reduce data loss.

, , discusses the concept of a testing strategy and leads you through testing an event-driven application.

, , covers the use of infrastructure as code and deploying an application as microservices.

, , discusses how to monitor a distributed application and make it observable with logging, metrics, and distributed tracing.

To get the most out of this book


This book is written with the expectation that you can execute the demonstration application to understand and view the code changes that have been made in each chapter as the application is refactored. To get the most out of the book, it is recommended you read the chapters in order, as the chapters will reference code that has been modified in the previous chapter.

Software/hardware covered in the book

Operating system requirements

Go 1.18+

Windows, macOS, or Linux

Docker 20.10.x

Windows, macOS, or Linux

NATS 2.4

Windows, macOS, or Linux

Most of the development for this book was done in Windows 10, but the code was tested to run in Windows Subsystem for Linux 2 (WSL 2) in Ubuntu 20.04 and tested to run on a Mac. You are expected to run the application and its dependencies within a Docker compose environment. Instructions to use Docker are given wherever possible to minimize installing new software on your machine.

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

You can follow the author on GitHub (https://github.com/stackus) or make a connection with them on LinkedIn (https://www.linkedin.com/in/stackmichael).

Download the example code files


You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Event-Driven-Architecture-in-Golang. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images


We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://packt.link/qgf1O.

Conventions used


There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “If all the participants have responded positively, then the coordinator will send a COMMIT message to all of the participants and the distributed transaction will be complete.”

A block of code is set as follows:

BEGIN; -- execute queries, updates, inserts, deletes … PREPARE TRANSACTION 'bfa1c57a-d99d-4d74-87a9-3aaabcc754ee';

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

func NewCommandHandlers(     app application.App,) ddd.CommandHandler         [ddd.Command] {     return commandHandlers{         app: app,

Any command-line input or output is written as follows:

--- PASS: TestApplication_AddItem (0.00s)

    --- PASS: TestApplication_AddItem/NoBasket (0.00s)

    --- PASS: TestApplication_AddItem/NoProduct (0.00s)

    --- PASS: TestApplication_AddItem/NoStore (0.00s)

    --- PASS: TestApplication_AddItem/SaveFailed (0.00s)

    --- PASS: TestApplication_AddItem/Success (0.00s)

PASS

Bold: Indicates a new term, an important word, or words that you see on screen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “The Customers module remains uncoupled from the Order Processing module because we do not have any explicit ties to the Order Processing module in this handler.”

Tips or Important Notes

Appear like this.

Get in touch


Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please...


Stack Michael :

Michael E. Stack is currently working as a solutions architect in a consulting firm called Booz Allen Hamilton. Michael has been working with Golang for 7 years. I have been using Golang to write microservices and open-source tools. He has more than 20+ years of software development experience which involves 10 years of experience working with complex n-tier systems. He has created more than 50+ projects that are complex and involve messaging patterns.



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.