Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Event-Driven Architecture in Golang

You're reading from   Event-Driven Architecture in Golang Building complex systems with asynchronicity and eventual consistency

Arrow left icon
Product type Paperback
Published in Nov 2022
Publisher Packt
ISBN-13 9781803238012
Length 384 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Michael Stack Michael Stack
Author Profile Icon Michael Stack
Michael Stack
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Part 1: Event-Driven Fundamentals
2. Chapter 1: Introduction to Event-Driven Architectures FREE CHAPTER 3. Chapter 2: Supporting Patterns in Brief 4. Chapter 3: Design and Planning 5. Part 2: Components of Event-Driven Architecture
6. Chapter 4: Event Foundations 7. Chapter 5: Tracking Changes with Event Sourcing 8. Chapter 6: Asynchronous Connections 9. Chapter 7: Event-Carried State Transfer 10. Chapter 8: Message Workflows 11. Chapter 9: Transactional Messaging 12. Part 3: Production Ready
13. Chapter 10: Testing 14. Chapter 11: Deploying Applications to the Cloud 15. Chapter 12: Monitoring and Observability 16. Index 17. Other Books You May Enjoy

The MallBots application

We’re going to be building a small application that simulates a retail experience coupled with some futuristic shopping robots. We will be building the backend services that power this application. A high-level view of the components involved is shown here:

Figure 1.8 – High-level view of the MallBots application components

Figure 1.8 – High-level view of the MallBots application components

The pitch

“We have developed incredible robots to save the time of people shopping at the mall. Customers will now have access to a kiosk that would facilitate the selection of items from available stores that customers do not wish to visit. After completing their selections, the customer is free to do other shopping or directly visit the depot and wait for their items to be brought in by robots. The customer may pay when they arrive at the depot or may choose to wait for all items to arrive before doing so. After both are done, the transaction is complete, and the customer takes their items and goes on their merry way.”

Application services

Starting with the four services—Orders, Stores, Payments, and Depot—on the right of Figure 1.8, we have the application services. These will all use events to communicate new states for triggers and notifications and will both publish them and subscribe to them. They will also have GRPC application programming interfaces (APIs) to support the API gateway layer.

API gateway services

The API gateway layer displayed down the center of Figure 1.8 will support a RESTful API for the customer kiosks, a management user interface (UI) with WebSocket subscriptions for the staff to use, and finally, a gRPC streams API for the robots. The API gateways are implemented as a demonstration of the Backend for Frontend (BFF) pattern.

The administrative BFF and the automation API gateways will create subscriptions to application events to allow delivery of state changes to clients. Note that we will not be developing API gateway services in this book.

Clients

Finally, on the left of Figure 1.8 are the expected clients, as outlined in more detail here:

  • Customer kiosks, placed near or at mall entrances for ease of use
  • An administrative web application for staff to manage the application data, process customer pickups, and take payment
  • Shopper bot clients that perform autonomous shopping tasks for the busy customers

A quick note about hexagons

You’re going to be seeing a lot of hexagons in the diagrams of this book. The services in Figure 1.8 all have some combinations of synchronous and asynchronous communication or connections, and all are drawn as hexagons, as depicted in the following diagram:

Figure 1.9 – Hexagonal representation of a service

Figure 1.9 – Hexagonal representation of a service

The API gateway and application services are all represented as hexagons with inputs (such as the API and event subscriptions, shown on the left) and the outputs (the database and event publications, on the right). This is a visual presentation of hexagonal architecture, and we will be talking more about that in Chapter 2, Supporting Patterns in Brief.

You have been reading a chapter from
Event-Driven Architecture in Golang
Published in: Nov 2022
Publisher: Packt
ISBN-13: 9781803238012
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime