{"id":28961251,"url":"https://github.com/fkucukkara/rabbitmqpubsub101","last_synced_at":"2026-04-18T07:37:22.571Z","repository":{"id":300554057,"uuid":"1006457943","full_name":"fkucukkara/rabbitMQPubSub101","owner":"fkucukkara","description":"This project demonstrates the classic Pub/Sub pattern using RabbitMQ as the message broker.","archived":false,"fork":false,"pushed_at":"2025-06-22T10:22:24.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-22T11:26:28.621Z","etag":null,"topics":["console-application","csharp","dotnetcore","producer-consumer","pubsub","rabbitmq"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fkucukkara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-22T10:13:38.000Z","updated_at":"2025-06-22T10:23:19.000Z","dependencies_parsed_at":"2025-06-22T11:27:06.585Z","dependency_job_id":"92e0d4ed-ea84-4a04-8c46-f601a0aba98f","html_url":"https://github.com/fkucukkara/rabbitMQPubSub101","commit_stats":null,"previous_names":["fkucukkara/rabbitmqpubsub101"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fkucukkara/rabbitMQPubSub101","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2FrabbitMQPubSub101","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2FrabbitMQPubSub101/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2FrabbitMQPubSub101/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2FrabbitMQPubSub101/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fkucukkara","download_url":"https://codeload.github.com/fkucukkara/rabbitMQPubSub101/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2FrabbitMQPubSub101/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261589893,"owners_count":23181433,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console-application","csharp","dotnetcore","producer-consumer","pubsub","rabbitmq"],"created_at":"2025-06-24T02:01:21.654Z","updated_at":"2026-04-18T07:37:22.534Z","avatar_url":"https://github.com/fkucukkara.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RabbitMQPubSub101\n\nA simple playground project demonstrating the basics of Publish/Subscribe (Pub/Sub) messaging with [RabbitMQ](https://www.rabbitmq.com/) in .NET. This solution contains a producer and two independent consumers, each implemented as a separate console application. The project is intended for learning and demonstration purposes and will be published to GitHub.\n\n---\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Project Structure](#project-structure)\n- [How It Works](#how-it-works)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Running RabbitMQ](#running-rabbitmq)\n  - [Building the Solution](#building-the-solution)\n  - [Running the Producer and Consumers](#running-the-producer-and-consumers)\n- [Code Highlights](#code-highlights)\n- [License](#license)\n\n---\n\n## Overview\n\nThis project demonstrates the classic Pub/Sub pattern using RabbitMQ as the message broker. The producer publishes messages to a fanout exchange, and each consumer receives a copy of every message by listening to its own queue bound to the exchange.\n\n---\n\n## Project Structure\n\n```\nRabbitMQPubSub101/\n│\n├── src/\n│   ├── Producer/\n│   │   ├── Producer.csproj\n│   │   └── Program.cs\n│   └── Consumers/\n│       ├── ConsumerOne/\n│       │   ├── ConsumerOne.csproj\n│       │   └── Program.cs\n│       └── ConsumerTwo/\n│           ├── ConsumerTwo.csproj\n│           └── Program.cs\n├── RabbitMQPubSub101.sln\n├── README.md\n└── LICENSE\n```\n\n- **Producer**: Publishes messages to the `messages` exchange. Located at `src/Producer`.\n- **ConsumerOne**: Listens to the `messageOne` queue. Located at `src/Consumers/ConsumerOne`.\n- **ConsumerTwo**: Listens to the `messageTwo` queue. Located at `src/Consumers/ConsumerTwo`.\n\n---\n\n## How It Works\n\n- The **Producer** connects to RabbitMQ and publishes messages to a durable fanout exchange named `messages`.\n- Each **Consumer** declares its own durable queue (`messageOne` or `messageTwo`) and binds it to the `messages` exchange.\n- Because the exchange is of type `fanout`, every message published by the producer is delivered to all bound queues, so both consumers receive every message.\n\n---\n\n## Getting Started\n\n### Cloning the Repository\nClone this repository to your local machine:\n\n```sh\ngit clone https://github.com/fkucukkara/rabbitMQPubSub101.git\ncd rabbitMQPubSub101\n```\n\n### Prerequisites\n\n- [.NET 9 SDK](https://dotnet.microsoft.com/download/dotnet/9.0)\n- [RabbitMQ](https://www.rabbitmq.com/download.html) running locally (default settings)\n- [Docker](https://www.docker.com/) (optional, for running RabbitMQ easily)\n\n### Running RabbitMQ\n\nYou can run RabbitMQ locally using Docker:\n\n```sh\ndocker run -d --hostname rabbitmq --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management\n```\n\n- Management UI: http://localhost:15672 (default user/pass: guest/guest)\n- AMQP port: 5672\n\n### Building the Solution\n\nFrom the root directory:\n\n```sh\ndotnet build RabbitMQPubSub101.sln\n```\n\n### Running the Producer and Consumers\n\nOpen three terminals and run each project:\n\n**Terminal 1: Producer**\n\n```sh\ndotnet run --project src/Producer/Producer.csproj\n```\n\n**Terminal 2: ConsumerOne**\n\n```sh\ndotnet run --project src/Consumers/ConsumerOne/ConsumerOne.csproj\n```\n\n**Terminal 3: ConsumerTwo**\n\n```sh\ndotnet run --project src/Consumers/ConsumerTwo/ConsumerTwo.csproj\n```\n\nYou should see both consumers printing every message published by the producer.\n\n## Code Highlights\n\n### Producer\n\n- Connects to RabbitMQ and declares a fanout exchange.\n- Publishes 5 messages, one per second, with persistent delivery mode.\n\nSee `src/Producer/Program.cs`.\n\n### Consumers\n\n- Each consumer declares its own queue and binds it to the `messages` exchange.\n- Uses `AsyncEventingBasicConsumer` for asynchronous message handling.\n- Acknowledges each message after processing.\n\nSee `src/Consumers/ConsumerOne/Program.cs` and `src/Consumers/ConsumerTwo/Program.cs`.\n\n---\n\n## Exchange Types in RabbitMQ\n\nWhile this project uses a **fanout** exchange (which broadcasts all messages to all bound queues), RabbitMQ supports several other exchange types, each with different routing logic:\n\n- **Direct Exchange**: Routes messages to queues based on an exact match between the routing key and the queue binding key.\n- **Topic Exchange**: Routes messages to queues based on pattern matching between the routing key and the binding pattern (supports wildcards).\n- **Headers Exchange**: Routes messages based on message header values instead of the routing key.\n- **Fanout Exchange**: (Used in this project) Broadcasts all messages to all queues bound to the exchange, ignoring routing keys.\n- **Default Exchange**: A special direct exchange with no name, allowing messages to be delivered directly to a queue with a name matching the routing key.\n\nFor more details, see the [RabbitMQ Exchange Types documentation](https://www.rabbitmq.com/tutorials/amqp-concepts.html#exchange).\n\n---\n\n## License\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nThis project is licensed under the MIT License. See the [`LICENSE`](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffkucukkara%2Frabbitmqpubsub101","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffkucukkara%2Frabbitmqpubsub101","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffkucukkara%2Frabbitmqpubsub101/lists"}