{"id":17586836,"url":"https://github.com/jasdvl/sample-aspnetcore-rabbitmq","last_synced_at":"2026-04-16T04:31:46.290Z","repository":{"id":258435770,"uuid":"869199000","full_name":"jasdvl/sample-aspnetcore-rabbitmq","owner":"jasdvl","description":"Sample integration of RabbitMQ in ASP.NET using YAML for configuration management","archived":false,"fork":false,"pushed_at":"2025-02-18T23:01:42.000Z","size":993,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T15:06:00.789Z","etag":null,"topics":["angular","aspnetcore","csharp","rabbitmq","signalr","yaml"],"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/jasdvl.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}},"created_at":"2024-10-07T22:14:05.000Z","updated_at":"2025-04-16T00:09:44.000Z","dependencies_parsed_at":"2024-10-19T01:44:18.913Z","dependency_job_id":null,"html_url":"https://github.com/jasdvl/sample-aspnetcore-rabbitmq","commit_stats":null,"previous_names":["jasdvl/sample-aspnetcore-rabbitmq"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jasdvl/sample-aspnetcore-rabbitmq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasdvl%2Fsample-aspnetcore-rabbitmq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasdvl%2Fsample-aspnetcore-rabbitmq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasdvl%2Fsample-aspnetcore-rabbitmq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasdvl%2Fsample-aspnetcore-rabbitmq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasdvl","download_url":"https://codeload.github.com/jasdvl/sample-aspnetcore-rabbitmq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasdvl%2Fsample-aspnetcore-rabbitmq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31871470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["angular","aspnetcore","csharp","rabbitmq","signalr","yaml"],"created_at":"2024-10-22T03:06:30.761Z","updated_at":"2026-04-16T04:31:46.269Z","avatar_url":"https://github.com/jasdvl.png","language":"C#","readme":"# RabbitMQ ASP.NET Core Integration Sample\n\n![architecture](./assets/architecture-overview.png)\n\n## Screenshots\n\nCheck out the [screenshots](./screenshots.md) for a visual overview.\n\n## Project Overview\n\nThis repository demonstrates how to integrate RabbitMQ into ASP.NET applications by utilizing both message publishers and consumers, with a focus on configuring RabbitMQ for client-side usage.  \nThe solution includes multiple projects to simulate workflows in a public library with RabbitMQ as the message broker. Additionally, it showcases how to manage RabbitMQ client configurations through a centralized `YAML` file embedded as a resource.\n\n**Note:**  \n\n\u003e This project is still under development. Features and functionalities may be added or changed in future updates.\n\u003e The codebase may undergo structural improvements in future updates.  \n\u003e See the [TODO List](#todo-list) for more details on planned improvements.  \n\u003e Please note that time constraints might delay updates to the TODO list.\n\n### Key Components\n\n1. **PubLib.Messaging.RabbitMQ**\n   - This project defines RabbitMQ consumers and publishers.\n   - The RabbitMQ client configuration is managed via an embedded `rabbitmq-config.yml` file, which contains settings for exchanges, queues, bindings, and publishers/consumers.  \n    This setup is specifically for configuring the client-side interaction with RabbitMQ and does not involve server configuration.  \n     \n    #### Example of the `rabbitmq-config.yml` file used for client configuration:\n\n    ```yaml\n    RabbitMQ:\n        HostName: localhost\n        Port: 5672\n        UserName: guest\n        Password: guest\n        Exchanges:\n            - Name: membership-status-exchange\n              Type: topic\n              Durable: true\n              AutoDelete: false\n              Publishers:\n                  - MembershipStatusPublisher\n            - Name: book-order-exchange\n              Type: topic\n              Durable: true\n              AutoDelete: false\n              Publishers:\n                  - BookOrderPublisher\n        Queues:\n            - Name: membership-status-queue\n              Durable: true\n              Exclusive: false\n              AutoDelete: false\n              Consumers:\n                  - MembershipStatusConsumer\n            - Name: book-reservation-queue\n              Durable: true\n              Exclusive: false\n              AutoDelete: false\n              Consumers:\n                  - BookReservationConsumer\n            - Name: book-provision-queue\n              Durable: true\n              Exclusive: false\n              AutoDelete: false\n              Consumers:\n                  - BookProvisionConsumer\n        Bindings:\n            - Queue: membership-status-queue\n              Exchange: membership-status-exchange\n              BindingKey: \"membership.status.*\"\n            - Queue: book-reservation-queue\n              Exchange: book-order-exchange\n              BindingKey: \"book.reservation.*\"\n            - Queue: book-provision-queue\n              Exchange: book-order-exchange\n              BindingKey: \"book.provision.*\"\n    ```\n    \n    - Inject the configuration into other projects via the `AddRabbitMQConfig()` extension method:\n\n    ```csharp\n    public static class ConfigurationExtensions\n    {\n        public static IConfigurationBuilder AddRabbitMQConfig(this IConfigurationBuilder builder)\n        {\n            return builder.AddYamlResource(\"PubLib.Messaging.RabbitMQ.rabbitmq-config.yml\");\n        }\n    }\n    ```\n\n    This method enables other projects to directly load project-specific RabbitMQ settings without handling resource paths manually.\n\n2. **publib.frontdesk.client (Angular)**\n   \n   - This Angular client allows users to apply for library membership and reserve books once registered.\n   - Book reservations and other actions are communicated to the ASP.NET Core backend through a REST API.\n   - The client also displays real-time notifications from the ASP.NET backend using SignalR.  \n\n3. **PubLib.FrontDesk.Server (ASP.NET Core)**\n   \n   - The backend for the Angular client, exposing REST endpoints to process membership applications and book reservations.\n   - Publishes these requests as messages to RabbitMQ in JSON format.\n   - Also contains a consumer that listens for notifications (e.g., book ready for pickup) from RabbitMQ and forwards them to the Angular client via SignalR.\n\n4. **PubLib.BackOffice (Blazor)**\n\n   - A Blazor Web App (interactive SSR) for managing library operations.\n   - It allows the Back Office to notify the Front Desk (via RabbitMQ) when a reserved book is ready for pickup.\n   - Contains RabbitMQ consumers that receive membership applications and book reservations from the Front Desk to process and display within the Blazor application.\n\n## Prerequisites\n\n- [.NET 9 SDK](https://dotnet.microsoft.com/download/dotnet/9.0)\n- [Node.js](https://nodejs.org/en/download/) for the Angular client\n- [Docker](https://www.docker.com/) for running RabbitMQ\n- [RabbitMQ](https://www.rabbitmq.com/download.html)\n\n## Setting up the SSL/TLS Certificates (Windows)\n\nThe developer certificates should be automatically created when starting the solution in Visual Studio. If this does not happen, or if the browser does not recognize the existing certificate as valid, please try the following:\n\n### 1. Angular Development Server\n\n- If ```%APPDATA%\\\\ASP.NET\\\\https\\\\publib.frontdesk.client.pem``` exists, it must be added to the list of Trusted Root Certification Authorities. Run the following command as an administrator:\n  \n    ```bash\n    certutil -addstore -f \"Root\" %APPDATA%\\\\ASP.NET\\\\https\\\\publib.frontdesk.client.pem\n    ```\n\n- If ```%APPDATA%\\\\ASP.NET\\\\https\\\\publib.frontdesk.client.pem``` does not exist, you can create a developer certificate as follows:\n  \n    ```bash\n    openssl req -x509 -nodes -days 365 -newkey rsa:2048 ^\n    -keyout %APPDATA%\\\\ASP.NET\\\\https\\\\publib.frontdesk.client.key ^\n    -out %APPDATA%\\\\ASP.NET\\\\https\\\\publib.frontdesk.client.pem ^\n    -subj \"/CN=localhost\" -addext \"subjectAltName=IP:127.0.0.1\"\n    ```\n\n    Afterward, it must be added to the list of Trusted Root Certification Authorities. To do this, run the following command with administrator privileges:\n\n    ```bash\n    certutil -addstore -f \"Root\" %APPDATA%\\\\ASP.NET\\\\https\\\\publib.frontdesk.client.pem\n    ```\n\n### 2. Blazor Web App\n\nYou can regenerate the developer certificates as follows:\n\n```bash\ndotnet dev-certs https --clean\ndotnet dev-certs https --trust\n```\n\n## Getting Started\n\n### 1. Start the RabbitMQ Server\n\nTo start a RabbitMQ server instance using Docker, run the following command:\n\n```bash\ndocker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.13-management\n```\n\nAlternatively, you can explore other installation options [here](https://www.rabbitmq.com/docs/download).\n\n### 2. Clone the Repository\n\n```bash\ngit clone https://github.com/jasdvl/sample-aspnetcore-rabbitmq.git\n```\n\n### 3. Run the Projects\n\nDepending on whether you're running the solution in Visual Studio or from the command line, follow the steps below:\n\n#### **3.1 Running the Solution in Visual Studio**\n\nAfter downloading and opening the solution in Visual Studio, it is recommended to configure multiple startup projects to run the application efficiently.\nWhile it's possible to start each project individually by setting it as the startup project, the most convenient approach is to configure multiple startup projects, so that all necessary services are launched simultaneously.\nFollow these steps to set up the three relevant projects as startup projects.\n\n**Steps to Configure Multiple Startup Projects in Visual Studio:**\n\n1. **Open the Solution:**\n   After downloading and extracting the solution from GitHub, open the `.sln` file in Visual Studio.\n\n2. **Access Startup Project Settings:**\n   - In **Solution Explorer**, right-click on the solution node (at the top).\n   - Select **Set Startup Projects...** from the context menu.\n\n3. **Select Multiple Startup Projects:**\n   - In the dialog that appears, choose **Multiple startup projects**.\n   - For each of the following projects, select **Start** from the drop-down menu next to the project name:\n     - PubLib.BackOffice\n     - PubLib.FrontDesk.Server\n     - publib.frontdesk.client\n\n4. **Save Changes:**\n   Click **OK** to save your changes.\n\nNow, all three projects will be configured to start together when you run the solution.\n\n**Note:**  \n\u003e If you're unfamiliar with how to set multiple startup projects, you can check the \n\u003e official [Visual Studio documentation](https://learn.microsoft.com/en-us/visualstudio/ide/how-to-set-multiple-startup-projects?view=vs-2022).\n\n---\n\n#### **3.2 Running the Solution from the Command Line**\n\nYou can also run the projects manually from the command line. Follow the instructions below to run each part of the application.  \nFirst, navigate to the project directory:  \n\n```bash\ncd sample-aspnetcore-rabbitmq/src\n```\n\n**1. Running the Back Office (Blazor Web App)**\n\nNavigate to the Blazor Web App directory and run the application:\n\n```bash\ncd PubLib.BackOffice\ndotnet run\n```\n\n**2. Running the Front Desk (Angular \u0026 ASP.NET Backend)**\n\nFirst, start the ASP.NET backend for publishing messages to RabbitMQ:\n\n```bash\ncd ..\\PubLib.FrontDesk.Server\ndotnet run\n```\n\nThen, start the Angular frontend by navigating to the client directory and running the following commands:\n\n```bash\ncd ..\\publib.frontdesk.client\nnpm install\nnpm start\n```\n\n**3. Sending and Viewing Messages**\n\n- Use the **PubLib.FrontDesk.Client** to send membership applications and book reservations via the REST API.\n- These requests will be published to RabbitMQ.\n- The **PubLib.BackOffice** will consume these messages and display them in real time.\n- The **PubLib.BackOffice** can also notify the Front Desk when a reserved book is ready for pickup.\n  This notification is sent via RabbitMQ and then forwarded as a SignalR message from the **PubLib.FrontDesk.Server** to the Angular client.\n\n\n## TODO List\n\n### Priority 1\n\n- Fix compiler warnings\n- Correct or adjust inconsistent or incorrect namespaces\n- Add XML comments\n- ~~Replace events with Channel\\\u003cT\\\u003e (superior asynchronous messaging with built-in backpressure and concurrent producer-consumer support.)~~\n\n### Priority 2\n\n- Refactor code\n\n### Priority 3\n\nThese items are considered \"nice to have\" and would enhance the system's capabilities. However, I’m not sure when I will be able to address them due to time constraints:\n\n- Implement RPC (Remote Procedure Call) pattern for request/response handling\n- Add message prioritization to queues\n- Implement Dead Letter Queues (DLQ) for failed message handling\n- Add message TTL (Time-to-Live) for automatic message expiration\n- Implement delayed messaging for deferred processing\n- Use Quorum Queues for higher availability and reliability\n\n## Branching Strategy\n\nSince I am the sole developer on this project, I primarily work on the `main` branch. I prefer to keep things simple by committing directly to `main` for most tasks. However, if a new feature requires multiple related commits or substantial changes, I will create feature branches to manage those updates. Once the feature is complete, the branch will be merged back into `main`. My goal is to keep the main branch stable and up to date.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasdvl%2Fsample-aspnetcore-rabbitmq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasdvl%2Fsample-aspnetcore-rabbitmq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasdvl%2Fsample-aspnetcore-rabbitmq/lists"}