{"id":21489766,"url":"https://github.com/minhhungit/msmqexts","last_synced_at":"2025-07-26T01:02:21.588Z","repository":{"id":40844775,"uuid":"195115935","full_name":"minhhungit/MsmqExts","owner":"minhhungit","description":"MSMQ (Microsoft Message Queuing) helper library","archived":false,"fork":false,"pushed_at":"2022-12-08T08:24:21.000Z","size":1201,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T10:25:05.154Z","etag":null,"topics":["message-queue","msmq","msmq-counter","msmqueue"],"latest_commit_sha":null,"homepage":null,"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/minhhungit.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}},"created_at":"2019-07-03T19:34:13.000Z","updated_at":"2022-12-06T16:51:13.000Z","dependencies_parsed_at":"2023-01-25T09:15:52.480Z","dependency_job_id":null,"html_url":"https://github.com/minhhungit/MsmqExts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhhungit%2FMsmqExts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhhungit%2FMsmqExts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhhungit%2FMsmqExts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhhungit%2FMsmqExts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minhhungit","download_url":"https://codeload.github.com/minhhungit/MsmqExts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250413950,"owners_count":21426504,"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":["message-queue","msmq","msmq-counter","msmqueue"],"created_at":"2024-11-23T14:27:47.846Z","updated_at":"2025-04-23T10:25:06.180Z","avatar_url":"https://github.com/minhhungit.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MsmqExts \u003ca href=\"https://www.nuget.org/packages/MsmqExts/\"\u003e\u003cimg src=\"https://img.shields.io/nuget/v/MsmqExts.svg?style=flat\" /\u003e \u003c/a\u003e\nMSMQ (Microsoft Message Queuing) helper library\n\n### Install\n```powershell\nInstall-Package MsmqExts\n```\n\n### Performance (Transaction queue)\n\n#### Single message producer ####\n```\nEnqueued 1 message in 0.26ms\nEnqueued 1 message in 0.26ms\nEnqueued 1 message in 0.27ms\nEnqueued 1 message in 0.28ms\nEnqueued 1 message in 0.29ms\nEnqueued 1 message in 0.27ms\n```\n\n#### Single message producer using C# Parallel ####\n```\nEnqueued 10000 messages(s) in 975.02ms, avg 0.1ms per message\nEnqueued 10000 messages(s) in 877.55ms, avg 0.09ms per message\nEnqueued 10000 messages(s) in 866.62ms, avg 0.09ms per message\nEnqueued 10000 messages(s) in 928.88ms, avg 0.09ms per message\nEnqueued 10000 messages(s) in 909.85ms, avg 0.09ms per message\n```\n\n#### Single message consumer ####\n```\nGot a product in 0.12ms | [\u003c11806 / 998a6e0\u003e - 21:12:12.710]\nGot a product in 0.18ms | [\u003c11807 / a0e25a3\u003e - 21:12:12.710]\nGot a product in 0.14ms | [\u003c11808 / fc7c5e0\u003e - 21:12:12.710]\nGot a product in 0.15ms | [\u003c11809 / 23bd871\u003e - 21:12:12.710]\nGot a product in 0.12ms | [\u003c11810 / 5e8cb24\u003e - 21:12:12.710]\nGot a product in 0.14ms | [\u003c11811 / 99d2df1\u003e - 21:12:12.710]\n```\n#### Batch messages producer ####\n```\nEnqueued a batch 50000 message(s) in 1853.38ms, avg 0.04ms per message\nEnqueued a batch 50000 message(s) in 1750.66ms, avg 0.04ms per message\nEnqueued a batch 50000 message(s) in 1796.26ms, avg 0.04ms per message\nEnqueued a batch 50000 message(s) in 1927.82ms, avg 0.04ms per message\nEnqueued a batch 50000 message(s) in 1916.92ms, avg 0.04ms per message\n```\n#### Batch messages consumer - batchSize 10_000 ####\n```\nTried to fetch a batch 10000 messages, got 10000/10000, avg 0.04ms per message\nTried to fetch a batch 10000 messages, got 10000/10000, avg 0.04ms per message\nTried to fetch a batch 10000 messages, got 10000/10000, avg 0.04ms per message\nTried to fetch a batch 10000 messages, got 10000/10000, avg 0.04ms per message\nTried to fetch a batch 10000 messages, got 10000/10000, avg 0.04ms per message\n```\n\n#### Batch message consumer - batchSize 50_000 ####\n```\nTried to fetch a batch 50000 messages, got 50000/50000, avg 0.05ms per message\nTried to fetch a batch 50000 messages, got 50000/50000, avg 0.04ms per message\nTried to fetch a batch 50000 messages, got 50000/50000, avg 0.04ms per message\nTried to fetch a batch 50000 messages, got 50000/50000, avg 0.04ms per message\nTried to fetch a batch 50000 messages, got 50000/50000, avg 0.04ms per message\n```\n## Demo\n### Simple Publisher\n```csharp\nvar messageQueue = new MsmqMessageQueue(\".\\\\private$\\\\hungvo-hello\");\nvar obj = new Product\n{\n    Id = 1,\n    Name = @\"Jin\"\n};\n\nmessageQueue.Enqueue(obj);\n```\n\n### Simple Consumer\n```csharp\nCancellationTokenSource tokenSource = new CancellationTokenSource();\nCancellationToken token = tokenSource.Token;\n\nvar msmqMessageQueue = new MsmqMessageQueue(\".\\\\private$\\\\hungvo-hello\");\n\ntry\n{\n    var message = _messageQueue.Dequeue(token);\n    if (message.Result is Product prod)\n    {\n        Console.WriteLine($\"- processing product \u003c{prod.Id}\u003e\");\n    }\n    message.Commit();\n}\ncatch (Exception ex)\n{\n    Console.WriteLine($\"Error: {ex.Message}\");\n    message.Abort();\n}\n```\n\n\u003e [Check more samples here](https://github.com/minhhungit/MsmqExts/tree/main/Sample)\n\n### Feature:\n- Support for immutable messages\n- Use very low CPU/RAM\n- Transaction\n- Batch enqueue/dequeue messages\n- Support netstandard2.0 \u0026 net462\n- Message persistence in mind\n\n### How to run sample: \n\n- [Create a MSMQ **transaction** queue](https://www.google.com/search?q=how+to+create+msmq+trasaction+queue)\n- Update queue name ( `AppConstants.MyQueueName` )\n- Run Publisher - Consumer\n- Enjoy\n\n---\n\nInspired by https://www.hangfire.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminhhungit%2Fmsmqexts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminhhungit%2Fmsmqexts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminhhungit%2Fmsmqexts/lists"}