Sample of using MassTransit in conjunction with RabbitMQ in an ASP.NET Core.
This application is intentionally designed as a simplified example for learning purposes. It does not adhere to best practices that you would typically use in a production application. Instead, it focuses on clarity and ease of understanding to help developers grasp the fundamentals of MassTransit and RabbitMQ.
Before you begin, make sure you have Docker installed on your machine. You can check if Docker is installed by running: docker --version
.
If Docker is not installed, you can download and install it from Docker's official website.
Ensure you have the .NET 7 SDK installed on your machine to build and run your .NET applications: dotnet --version
.
To build and run your application using Docker Compose with environment variables, follow these steps:
-
Open a terminal in the solution folder
...\MassTransitRabitMQ
. -
Build the Docker containers:
docker-compose -f docker-compose.yml --env-file .env.development build
- Start the containers:
docker-compose -f docker-compose.yml --env-file .env.development up
- To stop and remove the containers when you're done, use the following command:
docker-compose down --rmi all
Once your applications are running, you can access them through Swagger or Postman:
- Swagger: Open your web browser and go to http:https://localhost:5000/swagger/index.html to interact with the TipsAPI using Swagger's user-friendly interface.
- Postman: If you prefer using Postman, you can make API requests to http:https://localhost:5000 with the appropriate endpoints.
- Swagger: Open your web browser and go to http:https://localhost:6000/swagger/index.html to interact with the ReportingAPI using Swagger's user-friendly interface.
- Postman: If you prefer using Postman, you can make API requests to http:https://localhost:6000 with the appropriate endpoints.