How madslundt/netcoremicroservicessample works
Main Components
• API Gateway: Represent the public entry point using Ocelot that routes client HTTP requests to the right microservice.
• Microservices: Create separate components for MoviesService, ReviewsService, and UsersService. Each microservice should be pictured as an autonomous unit hosting its own REST API, and handling its own commands, queries, controllers, event handlers, and even update handlers (when using event sourcing).
• Event Publishing/Subscription Elements: Show how microservices publish domain events (for instance, via a command bus and event bus) and subscribe to events using a message broker.
• Infrastructure Services: Illustrate the shared Infrastructure layer that provides:
• Consul (for service discovery)
• Core functionalities (commands, queries, events, validation, mapping, exception filtering)
• EventStore (supporting MongoDB and EF Core options)
• Outbox pattern (for reliable event publishing)
• MessageBrokers (with RabbitMQ as the primary broker)
• Logging (through Serilog and ELK/Kibana)
• Swagger (for API documentation)
• External Dependencies: Include external components from the Compose folder such as SQL Server, RabbitMQ, Elasticsearch, Kibana, and any other containerized services brought in via Docker Compose.
Relationships and Interaction Flows
• Components from the Infrastructure layer to the microservices:
Architectural Patterns and Key Technologies
• Use of Event Sourcing and Outbox patterns (especially in MoviesService and ReviewsService) to capture and reliably publish domain events.
• That communication between services is event-driven (via RabbitMQ) while REST API calls are used for direct client and inter-service requests routed through the API Gateway.
• Inclusion of Consul for dynamic service discovery, meaning that microservices locate one another by name or ID rather than hardcoded URIs.
• Text labels for key third-party tools such as:
• Ocelot (for API Gateway implementation)
• MediatR (for internal mediator pattern implementation in Commands, Queries, and Event handling)
• EF Core & MongoDB (for persistence in the EventStore and Outbox)
Putting It All Together
• Then detail each microservice’s internal architecture and the supporting Infrastructure layer.
• Annotations for service discovery (Consul), event persistence (EventStore), and Outbox processing.