A demo project demonstrating the use of RabbitMQ for message queuing and handling in a distributed system. This repository serves as a starting point for learning and experimenting with RabbitMQ integration in .NET applications.
- Message Queuing: Utilizes RabbitMQ for reliable message delivery.
- Publisher-Subscriber Pattern: Implements a basic pub-sub model.
- Scalable Architecture: Designed for distributed systems.
- .NET Integration: Built using C# and .NET.
Before running the project, ensure you have the following installed:
- RabbitMQ Server: Install and configure RabbitMQ on your local machine or use a hosted solution.
- .NET SDK: Version 6.0 or higher.
- Docker: Optional, for containerizing the RabbitMQ server.
git clone https://github.com/anti-pc/RabbitMQDemo.git
cd RabbitMQDemoNavigate to the project directory and restore the dependencies:
dotnet restore- Default Setup: Ensure RabbitMQ is running locally on its default port (5672).
- Custom Setup: Update the connection details in the
appsettings.jsonfile:
{
"RabbitMQ": {
"HostName": "localhost",
"UserName": "guest",
"Password": "guest"
}
}
To start the application, use the following command:
dotnet runRabbitMQDemo/
├── Publisher/
│ ├── Program.cs
│ ├── Publisher.cs
├── Subscriber/
│ ├── Program.cs
│ ├── Subscriber.cs
├── appsettings.json
└── README.md
- Publisher: Sends messages to the RabbitMQ queue.
- Subscriber: Listens to the queue and processes messages.
- Start the RabbitMQ server.
- Run the Publisher to send messages:
dotnet run --project Publisher
- Run the Subscriber to process messages:
dotnet run --project Subscriber
Access the RabbitMQ Management Dashboard at:
http://localhost:15672
- Default credentials:
- Username:
guest - Password:
guest
- Username:
- Connection Issues: Ensure RabbitMQ is running and the connection settings in
appsettings.jsonare correct. - Message Delivery Failures: Check RabbitMQ logs for errors and ensure the queue is correctly configured.
Contributions are welcome! Feel free to submit a pull request or open an issue for discussion.
This project is licensed under the MIT License.
docker run -d --hostname rmq --name rabbit-server -p 8080:15672 -p 5672:5672 rabbitmq:3-management