Event-Driven Architecture in Golang Building Complex Systems with Asynchronicity and Eventual Consistency

Begin building event-driven microservices, including patterns to handle data consistency and resiliency Key Features Explore the benefits and tradeoffs of event-driven architectures with practical examples and use cases Understand synergy with event sourcing, CQRS, and domain-driven development in s...

Full description

Bibliographic Details
Other Authors: Stack, Michael, 1950- author (author)
Format: eBook
Language:Inglés
Published: Birmingham, England : Packt Publishing [2022]
Edition:First edition
Subjects:
See on Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009703306506719
Table of Contents:
  • 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.