This post explains Event-Driven Architecture using RabbitMQ, Domain-Driven Design, and Clean Architecture. It covers the concepts of events, commands, and actors, and provides code examples in Go (golang) to create events, entities, publishers, DTOs, use cases, controllers, and more. It also demonstrates how to listen to events and execute commands based on them.
•11m read time• From medium.com
Table of contents
Event-Driven Architecture in Go (golang)What is Event-Driven Architecture?Modeling the EVENTS !!!The problem:My proposed solution:Hands onCreating EntitiesCreating Publisher interfaceCreating DTO'sCreating Commands (or UseCases)Creating ControllerCreating MemoryQueueAdapterCreating Application entrypoint/startRunning the applicationTest /create-order endpointSummary so farCreating listenner commandsCreating Listeners handlers in OrderControllerCreating Listener structCreating QueueResponseWriter structCreating Queue interfaceImplementing methods in MemoryQueueAdapterBinding events with de listeners handlersConsuming the eventsExtra (implementing with RabbitMQ)Using docker to up RabbitMQ serverRunning RabbitMQ serverSort: