
Explore a .NET 8 microservices architecture with RabbitMQ and MassTransit, using mediator patterns and four services (flight, booking, payment, notification) and databases MongoDB, Redis, PostgreSQL, SQL Server.
Run the command prompt as Administrator
Navigate to the sbin directory and uninstall the service. rabbitmq-service remove
Reinstall the service rabbitmq-service install
Enable the plugins. rabbitmq-plugins enable rabbitmq_management
Start the service rabbitmq-service start
Set up the solution and folder structure in Visual Studio 2022, creating building blocks, common and contracts folders, and four microservice projects for flight, booking, payment, and notification.
Connect all four microservices to a single airline booking system database, create and seed four tables—bookings, flights, notifications, payments—with defined fields, and validate basic CRUD operations in SQL Server 2022.
Define core entities for bookings, flights, notifications, and payments in separate microservice cores, establishing their properties and preparing repository interfaces for clean architecture.
Define repository interfaces for microservices in a clean architecture, decoupling core entities from data stores and APIs. Implement IBookingRepository, IFlightRepository, INotificationRepository, and IPaymentRepository with async methods.
Set up the booking repository in the infrastructure layer using a SQL connection and dapper, wiring up appsettings connection strings and IDbConnection for async operations.
Connect the flight infrastructure by wiring the shared SQL connection in appsettings and program.cs, implement the flight repository with Dapper, and enable flight add, delete, and query operations.
Implement a notification repository in the infrastructure layer by wiring the IDB connection and implementing INotificationRepository. Log notifications to a database via a dapper-based insert into the notifications table.
Set up the notification application layer with a send notification command and handler, a notification service interface and implementation, and register MediatR to enable mass transit publishing.
Launch a lean bookings api by implementing a bookings controller and wiring it to a mediator for create and get operations via cqrs, with routes at api/bookings.
Rename the controller to notifications controller, set the api/notifications route, remove weather forecast code, implement post endpoint sending a notification via mediator with a from body command and return ok.
Build a payments api by configuring a payments controller at api/payments, and expose two post endpoints that use a mediator to process payment and refund commands, testable via swagger.
Set up building blocks for inter-service communication with RabbitMQ and MassTransit by creating queues for flight booked, payment processed, and notification, and defining event contracts as records.
Connect mass transit to RabbitMQ to make the booking microservice publish flight booked events and consume notification events, using a publish endpoint and a notification event consumer.
Debug and validate a four-microservice workflow using MassTransit and RabbitMQ by booking, tracing the flight booked event through payment and notification services, and confirming end-to-end message flow.
Install and set up MongoDB and Compass, create a flights database and flights collection, import JSON data, and refactor the flight microservice to use MongoDB instead of SQL Server.
Refactor the flights microservice to use MongoDB, replacing SQL Server, by updating app settings, introducing a Mongo context and repository, and testing via swagger.
Install Docker Desktop and run a RedisAI container locally to cache booking data, connect via RedisAI insight, and create booking keys prefixed with booking_ for the refactored booking microservice.
Refactor the booking microservice to use Redis for caching, swapping SQL server with a Redis-backed repository, configuring the connection, and serializing bookings for storage and retrieval.
Get Started with .NET 8 Microservices using RabbitMQ and MassTransit!
Are you a student or professional looking to dive into software engineering? Want to quickly set up a .NET Core environment for building Microservices with RabbitMQ messaging, but don’t want to wade through unnecessary complexities? This course is designed just for you!
In this course, I’ll guide you through setting up your development environment and introduce you to the core concepts of .NET Core Microservices with RabbitMQ. You’ll learn how to design and implement Microservices using MassTransit for messaging, with a hands-on, step-by-step approach. By the end, you’ll have the skills to build apps that communicate efficiently using messaging patterns, setting the foundation for more advanced topics in software development. Additionally, you'll gain a deeper understanding of distributed systems, fault tolerance, and message-driven architecture, which are crucial for building reliable and robust applications in modern software ecosystems.
Whether you're transitioning to software engineering or enhancing your existing skill set, this course will take you a step closer to mastering .NET technologies. You'll be ready to tackle real-world projects and start building scalable, high-performance applications using modern design principles. Join now, and start your journey into the world of Microservices with .NET Core!