{"id":22895419,"url":"https://github.com/grumpybusted/grumpy.messagequeue","last_synced_at":"2025-05-07T20:02:34.269Z","repository":{"id":65414314,"uuid":"117292944","full_name":"GrumpyBusted/Grumpy.MessageQueue","owner":"GrumpyBusted","description":"Extended and opinionated API for Microsoft Message Queue (MSMQ)","archived":false,"fork":false,"pushed_at":"2019-01-11T20:58:04.000Z","size":110,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T20:01:51.540Z","etag":null,"topics":["ack","api-wrapper","listener","message-queue","messagequeue","msmq","nack","nuget","queue","transaction-message"],"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/GrumpyBusted.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":"2018-01-12T22:14:33.000Z","updated_at":"2020-06-29T08:55:02.000Z","dependencies_parsed_at":"2023-01-23T10:55:12.532Z","dependency_job_id":null,"html_url":"https://github.com/GrumpyBusted/Grumpy.MessageQueue","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrumpyBusted%2FGrumpy.MessageQueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrumpyBusted%2FGrumpy.MessageQueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrumpyBusted%2FGrumpy.MessageQueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrumpyBusted%2FGrumpy.MessageQueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrumpyBusted","download_url":"https://codeload.github.com/GrumpyBusted/Grumpy.MessageQueue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252949272,"owners_count":21830151,"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":["ack","api-wrapper","listener","message-queue","messagequeue","msmq","nack","nuget","queue","transaction-message"],"created_at":"2024-12-13T23:29:16.328Z","updated_at":"2025-05-07T20:02:34.149Z","avatar_url":"https://github.com/GrumpyBusted.png","language":"C#","readme":"[![Build status](https://ci.appveyor.com/api/projects/status/kikmu5buw86b2pj0?svg=true)](https://ci.appveyor.com/project/GrumpyBusted/grumpy-messagequeue)\n[![codecov](https://codecov.io/gh/GrumpyBusted/Grumpy.MessageQueue/branch/master/graph/badge.svg)](https://codecov.io/gh/GrumpyBusted/Grumpy.MessageQueue)\n[![nuget](https://img.shields.io/nuget/v/Grumpy.MessageQueue.svg)](https://www.nuget.org/packages/Grumpy.MessageQueue/)\n[![downloads](https://img.shields.io/nuget/dt/Grumpy.MessageQueue.svg)](https://www.nuget.org/packages/Grumpy.MessageQueue/)\n\n# Grumpy.MessageQueue\nAPI for Microsoft Message Queue (MSMQ).\n\nThis API extents the API with:\n- Larger messages (Move the limit from 4MB to the size of a string 1-2GB)\n- Transactional messages with Ack and NAck feature\n- Queue Handler (Listener) to trigger handler method when messages are received\n- Automatic management of queues (Create and Delete)\n- Cancelable Receiver\n- Async Receiver\n\nThis API includes the features that are most used (and needed for my other solution). The API makes the use\nof MSMQ easy and strait forward. I know this library is opinionated and only provide a sub set of the features\nin MSMQ API for Microsoft Message Queue (MSMQ).\n\n## Send and Receive\nThe following code sample will:\n- Create a new Private Queue on the current maschine, if not exists\n- Open a connections to the queue\n- Send a Message\n- Receive the same message\n- Close the connection\n```csharp\nvar queueFactory = new QueueFactory();\n\nusing (var queue = queueFactory.CreateLocale(\"MyQueue\", true, LocaleQueueMode.DurableCreate, true)) \n{\n    // Message will be serialized to json and chumped into pieces, all pieces send in the same transaction\n    queue.Send(\"MyMessage\");\n\n    // The receive has a timeout of 1 sec, and the message will be deserialized to the type (here string). This receive will automatically Ack the message\n    var response = queue.Receive\u003cstring\u003e(1000, new CancellationToken());\n}\n```\n\n## Receive and Ack\nThe following code sample will:\n- Receive a transactional message\n- Try to Handle the message in some other method\n- If any exception, NAck the message for next receive to handle the samme message\n```csharp\nvar queueFactory = new QueueFactory();\n\nusing (var queue = queueFactory.CreateLocale(\"MyQueue\", true, LocaleQueueMode.Durable, true)) \n{\n    var message = queue.Receive(1000, new CancellationToken());\n\n    try {\n        Handle(messege.Message)\n        message.Ack();\n    }\n    catch\n    {\n        message.NAck();\n    }\n}\n```\n\n## Queue Handler (Listerner)\nThe following code sample will:\n- Create a Queue handler\n- Start Listening to a Queue\n- For each message call the method MessageHandler\n- Ack and NAck are handled in the QueueHandler\n```csharp\nvar queueFactory = new QueueFactory();\nvar queueHandlerFactory = new QueueHandlerFactory(queueFactory);\n\nusing (var queueHandler = queueHandlerFactory.Create()) \n{\n    queueHandler.Start(\"MyQueue\", true, LocaleQueueMode.Durable, true, MessageHandler, null, null, 0, true, false, new CancellationToken());\n\n    // Wait for ever, or until cancelled\n}\n\npublic void MessageHandler(object message, CancellationToken cancellationToken) \n{\n    // Do stuff with message\n}\n```\n\nJust ask for more samples!!!","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrumpybusted%2Fgrumpy.messagequeue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrumpybusted%2Fgrumpy.messagequeue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrumpybusted%2Fgrumpy.messagequeue/lists"}