ENGLISH

Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency

Book information

Publisher
Packt Publishing
Year
2022
ISBN
1803238011, 9781803238012
Language
english
Format
PDF
Filesize
31 MB (32158558 bytes)
Pages
384\384
Time added
2022-11-07 19:18:47

Description

Begin building event-driven microservices, including patterns to handle data consistency and resiliency Key FeaturesExplore the benefits and tradeoffs of event-driven architectures with practical examples and use casesUnderstand synergy with event sourcing, CQRS, and domain-driven development in software architectureBuild an end-to-end robust application architecture by the end of the bookBook Description 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. What you will learnUnderstand different event-driven patterns and best practicesPlan and design your software architecture with easeTrack changes and updates effectively using event sourcingTest and deploy your sample software application with easeMonitor and improve the performance of your software architectureWho this book is for This hands-on book is for intermediate-level software architects, or senior software engineers working with Golang and interested in building asynchronous microservices using event sourcing, CQRS, and DDD. Intermediate-level knowledge of the Go syntax and concurrency features is necessary. Table of ContentsIntroduction to Event-Driven ArchitecturesSupporting Patterns In BriefDesign and PlanningEvent FoundationsTracking Changes with Event SourcingAsynchronous ConnectionsEvent-carried State TransferEvent WorkflowsTransactional MessagingTestingDeploying applications to the cloudMonitoring and Observability Cover Title Page Copyright and Credits Dedication Contributors Table of Contents Preface Part 1: Event-Driven Fundamentals Chapter 1: Introduction to Event-Driven Architectures Technical requirements An exchange of facts Event notifications Event-carried state transfer Event sourcing Core components Wrap-up The MallBots application The pitch Application services API gateway services Clients A quick note about hexagons Benefits of EDA Resiliency Agility User experience (UX) Analytics and auditing Challenges of EDA Eventual consistency Dual writes Distributed and asynchronous workflows Debuggability Getting it right Summary Chapter 2: Supporting Patterns in Brief Domain-driven design DDD misconceptions So, what is it all about then? How is it useful for EDA? Domain-centric architectures An evolving solution Hexagonal architecture applied Testing A rulebook, not a guidebook Should you use domain-centric architectures? How is it useful for EDA? Command and Query Responsibility Segregation The problem being solved Applying CQRS When to consider CQRS CQRS and event sourcing Task-based UI Application architectures Monolithic architecture Microservices Recommendation for green field projects Summary Further reading Chapter 3: Design and Planning Technical requirements What are we building? Finding answers with EventStorming What is EventStorming? Big Picture EventStorming Design-level EventStorming Understanding the business Recording architectural decisions Summary Further reading Part 2: Components of Event-Driven Architecture Chapter 4: Event Foundations Technical requirements A tour of MallBots The responsibilities of the monolith Module code organization User interface Running the monolith A focus on event-driven integration and communication patterns Taking a closer look at module integration Using external data Commanding external components Types of events Domain events Event sourcing events Integration events Refactoring side effects with domain events What about the modules not using DDD? Summary Chapter 5: Tracking Changes with Event Sourcing Technical requirements What is event sourcing? Understanding the difference between event streaming and event sourcing Adding event sourcing to the monolith Beyond basic events Adding the event sourcing package Using just enough CQRS A group of stores is called a mall A group of products is called a catalog Taking note of the little things Connecting the domain events with the read model Recapping the CQRS changes Aggregate event stream lifetimes Taking periodic snapshots of the event stream Using snapshots Summary Chapter 6: Asynchronous Connections Technical requirements Asynchronous integration with messages Integration with notification events Integration with event-carried state transfer Eventual consistency Message-delivery guarantees Idempotent message delivery Ordered message delivery Implementing messaging with NATS JetStream The am package The jetstream package Making the Store Management module asynchronous Modifying the monolith configuration Updating the monolith application Providing to the modules the JetStreamContext Publishing messages from the Store Management module Receiving messages in the Shopping Baskets module Verifying we have good communication Summary Chapter 7: Event-Carried State Transfer Technical requirements Refactoring to asynchronous communication Store Management state transfer Customer state transfer Order processing state transfer Payments state transfer Documenting the asynchronous API Adding a new order search module Building read models from multiple sources Creating a read model record Summary Chapter 8: Message Workflows Technical requirements What is a distributed transaction? Why do we need distributed transactions? Comparing various methods of distributed transactions The 2PC The Saga Implementing distributed transactions with Sagas Adding support for the Command and Reply messages Adding an SEC package Converting the order creation process to use a Saga Adding commands to the saga participants Implementing the create order saga execution coordinator Summary Chapter 9: Transactional Messaging Technical requirements Identifying problems faced by distributed applications Identifying problems in synchronous applications Identifying problems in asynchronous applications Examining potential ways to address the problem The singular write solution Exploring transactional boundaries How the implementation will work The di package Updating the Depot module with dependency containers Using an Inbox and Outbox for messages Implementing a messages inbox Implementing a messages outbox Summary Part 3: Production Ready Chapter 10: Testing Technical requirements Coming up with a testing strategy Unit tests Integration tests Contract tests End-to-end tests Testing the application and domain with unit tests Table-driven testing Creating and using test doubles in our tests Testing dependencies with integration testing Incorporating the dependencies into your tests Running tests with more complex setups Testing ProductCacheRepository Breaking tests into groups Testing component interactions with contract tests Consumer expectations Provider verifications Not building any silos Contract testing with Pact REST consumer and provider example Message consumer and provider example Testing the application with end-to-end tests Relationship with behavior-driven development E2E test organization Making executable specifications out of our features What to test or not test Summary Chapter 11: Deploying Applications to The Cloud Technical requirements Turning the modular monolith into microservices Refactoring the monolith construct Updating the composition root of each module Making each module run as a service Updates to the Dockerfile build processes Updates to the Docker Compose file Adding a reverse proxy to the compose environment Fixing the gRPC connections Installing the necessary DevOps tools Installing every tool into a Docker container Installing the tools into your local system Using Terraform to configure an AWS environment Preparing for the deployment A look at the AWS resources we are deploying Deploying the infrastructure Viewing the Kubernetes environment Deploying the application to AWS with Terraform Getting to know the application resources to be deployed Deploying the application Tearing down the application and infrastructure Summary Chapter 12: Monitoring and Observability Technical requirements What are monitoring and observability? The three pillars of observability How tracing works Instrumenting the application with OpenTelemetry and Prometheus Adding distributed tracing to the application Adding metrics to the application Viewing the monitoring data Summary Index About Packt Other Books You May Enjoy

Similar books

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

2010 · PDF

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

1858 · PDF

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

2022 · PDF

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

1809 · PDF