{"id":20893115,"url":"https://github.com/hangfireio/hangfire.azure.servicebusqueue","last_synced_at":"2025-10-25T12:19:13.748Z","repository":{"id":17128499,"uuid":"19894745","full_name":"HangfireIO/Hangfire.Azure.ServiceBusQueue","owner":"HangfireIO","description":"ServiceBus Queue support for SQL Server job storage implementation","archived":false,"fork":false,"pushed_at":"2025-04-14T02:16:10.000Z","size":9064,"stargazers_count":59,"open_issues_count":8,"forks_count":34,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-19T11:07:17.772Z","etag":null,"topics":[],"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/HangfireIO.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","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":"2014-05-17T19:43:50.000Z","updated_at":"2025-04-16T01:54:36.000Z","dependencies_parsed_at":"2025-01-15T09:32:41.914Z","dependency_job_id":"6a7f80d8-ca9c-4322-b4c4-bdbe74486da5","html_url":"https://github.com/HangfireIO/Hangfire.Azure.ServiceBusQueue","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/HangfireIO/Hangfire.Azure.ServiceBusQueue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HangfireIO%2FHangfire.Azure.ServiceBusQueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HangfireIO%2FHangfire.Azure.ServiceBusQueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HangfireIO%2FHangfire.Azure.ServiceBusQueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HangfireIO%2FHangfire.Azure.ServiceBusQueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HangfireIO","download_url":"https://codeload.github.com/HangfireIO/Hangfire.Azure.ServiceBusQueue/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HangfireIO%2FHangfire.Azure.ServiceBusQueue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278173367,"owners_count":25942293,"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","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"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":[],"created_at":"2024-11-18T10:14:42.756Z","updated_at":"2025-10-03T14:07:35.917Z","avatar_url":"https://github.com/HangfireIO.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Hangfire.Azure.ServiceBusQueue\n============================\n\n[![Official Site](https://img.shields.io/badge/site-hangfire.io-blue.svg)](http://hangfire.io) [![Latest version](https://img.shields.io/badge/nuget-latest-blue.svg)](https://www.nuget.org/packages/HangFire.Azure.ServiceBusQueue/) [![Build status](https://ci.appveyor.com/api/projects/status/3l7dued0cvkjascj?svg=true)](https://ci.appveyor.com/project/odinserj/hangfire-azure-servicebusqueue) [![License MIT](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)\n\nWhat is it?\n-----------\n\nAdds support for using Azure Service Bus Queues with [Hangfire](http://hangfire.io)'s SQL storage provider to reduce latency and remove the need to poll the database for new jobs.\n\nAll job data continues to be stored and maintained within SQL storage, but polling is removed in favour of pushing the job ids through the service bus.\n\nInstallation\n-------------\n\nHangfire.Azure.ServiceBusQueue is available as a NuGet package. Install it using the NuGet Package Console window:\n\n```\nPM\u003e Install-Package Hangfire.Azure.ServiceBusQueue\n```\n\nCompatibility\n-------------\n\nHangfire v1.7+ introduced breaking changes to the SQL Server integration points and requires at least version 4.0.0 of this library. If you are on an older version of Hangfire please use a lower version of Hangfire.Azure.ServiceBusQueue\n\nUsage\n------\n\nTo use the queue it needs to be added to your existing SQL Server storage configuration.\n\n\nFor .NETCore and beyond, you can use the `IGlobalConfiguration` extension `.UseServiceBusQueues`:\n\n```csharp\n\n//You can use .UseServiceBusQueues only after .UseSqlStorage()\n\n// Uses default options (no prefix or configuration) with the \"default\" queue only\nservices.AddHangfire(configuration =\u003e configuration\n    .UseSqlServerStorage(\"\u003csql connection string\u003e\")\n    .UseServiceBusQueues(\"\u003cazure servicebus connection string\u003e\")\n    \n// Uses default options (no prefix or configuration) with the \"critical\" and \"default\" queues\nservices.AddHangfire(configuration =\u003e configuration\n    .UseSqlServerStorage(\"\u003csql connection string\u003e\")\n    .UseServiceBusQueues(\"\u003cazure servicebus connection string\u003e\", \"critical\", \"default\")\n    \n// Configures queues on creation and uses the \"crtical\" and \"default\" queues\nservices.AddHangfire(configuration =\u003e configuration\n    .UseSqlServerStorage(\"\u003csql connection string\u003e\")\n    .UseServiceBusQueues(\"\u003cazure servicebus connection string\u003e\", \n        queueOptions =\u003e {\n            queueOptions.MaxSizeInMegabytes = 5120;\n            queueOptions.DefaultMessageTimeToLive = new TimeSpan(0, 1, 0);\n        } \"critical\", \"default\")\n    \n// Specifies all options\nservices.AddHangfire(configuration =\u003e configuration\n    .UseSqlServerStorage(\"\u003csql connection string\u003e\")\n    .UseServiceBusQueues(new ServiceBusQueueOptions\n    {\n        ConnectionString = connectionString,\n                \n        Configure = configureAction,\n        \n        // The actual queues used in Azure will have this prefix if specified\n        // (e.g. the \"default\" queue will be created as \"my-prefix-default\")\n        //\n        // This can be useful in development environments particularly where the machine\n        // name could be used to separate individual developers machines automatically\n        // (i.e. \"my-prefix-{machine-name}\".Replace(\"{machine-name}\", Environment.MachineName))\n        QueuePrefix = \"my-prefix-\",\n        \n        // The queues to monitor. This *must* be specified, even to set just\n        // the default queue as done here\n        Queues = new [] { EnqueuedState.DefaultQueue },\n        \n        // By default queues will be checked and created on startup. This option\n        // can be disabled if the application will only be sending / listening to \n        // the queue and you want to remove the 'Manage' permission from the shared\n        // access policy.\n        //\n        // Note that the dashboard *must* have the 'Manage' permission otherwise the\n        // queue length cannot be read\n        CheckAndCreateQueues = false,\n        \n        // Typically a lower value is desired to keep the throughput of message processing high. A lower timeout means more calls to\n        // Azure Service Bus which can increase costs, especially on an under-utilised server with few jobs.\n        // Use a Higher value for lower costs in non production or non critical jobs\n        LoopReceiveTimeout = TimeSpan.FromMilliseconds(500)\n        \n        // Delay between queue polling requests\n        QueuePollInterval = TimeSpan.Zero\n    }));\n```\nYou can also use `UseServiceBusQueues` overloads:\n\n```csharp\nvar sqlStorage = new SqlServerStorage(\"\u003cconnection string\u003e\");\n\n// The connection string *must* be for the root namespace and have the \"Manage\"\n// permission if used by the dashboard\nvar connectionString = CloudConfigurationManager.GetSetting(\"Microsoft.ServiceBus.ConnectionString\");\n\n// You can configure queues on first creation using this action\nAction\u003cQueueDescription\u003e configureAction = qd =\u003e\n{\n    qd.MaxSizeInMegabytes = 5120;\n    qd.DefaultMessageTimeToLive = new TimeSpan(0, 1, 0);\n};\n\n// Uses default options (no prefix or configuration) with the \"default\" queue only\nsqlStorage.UseServiceBusQueues(connectionString);\n\n// Uses default options (no prefix or configuration) with the \"critical\" and \"default\" queues\nsqlStorage.UseServiceBusQueues(connectionString, \"critical\", \"default\"); \n\n// Configures queues on creation and uses the \"crtical\" and \"default\" queues\nsqlStorage.UseServiceBusQueues(connectionString, configureAction, \"critical\", \"default\"); \n    \n// Specifies all options\nsqlStorage.UseServiceBusQueues(new ServiceBusQueueOptions\n    {\n        ConnectionString = connectionString,\n\n        Credential = new DefaultAzureCredential() // any Azure.Identity.TokenCredential\n                \n        Configure = configureAction,\n        \n        // The actual queues used in Azure will have this prefix if specified\n        // (e.g. the \"default\" queue will be created as \"my-prefix-default\")\n        //\n        // This can be useful in development environments particularly where the machine\n        // name could be used to separate individual developers machines automatically\n        // (i.e. \"my-prefix-{machine-name}\".Replace(\"{machine-name}\", Environment.MachineName))\n        QueuePrefix = \"my-prefix-\",\n        \n        // The queues to monitor. This *must* be specified, even to set just\n        // the default queue as done here\n        Queues = new [] { EnqueuedState.DefaultQueue },\n        \n        // By default queues will be checked and created on startup. This option\n        // can be disabled if the application will only be sending / listening to \n        // the queue and you want to remove the 'Manage' permission from the shared\n        // access policy.\n        //\n        // Note that the dashboard *must* have the 'Manage' permission otherwise the\n        // queue length cannot be read\n        CheckAndCreateQueues = false,\n        \n        // Typically a lower value is desired to keep the throughput of message processing high. A lower timeout means more calls to\n        // Azure Service Bus which can increase costs, especially on an under-utilised server with few jobs.\n        // Use a Higher value for lower costs in non production or non critical jobs\n        LoopReceiveTimeout = TimeSpan.FromMilliseconds(500)\n        \n        // Delay between queue polling requests\n        QueuePollInterval = TimeSpan.Zero\n    });\n\nGlobalConfiguration.Configuration\n    .UseStorage(sqlStorage);\n```\n\nQuestions? Problems?\n---------------------\n\nOpen-source project are developing more smoothly, when all discussions are held in public.\n\nIf you have any questions or problems related to Hangfire itself or this queue implementation or want to discuss new features, please visit the [discussion forum](http://discuss.hangfire.io). You can sign in there using your existing Google or GitHub account, so it's very simple to start using it.\n\nIf you've discovered a bug, please report it to the [Hangfire GitHub Issues](https://github.com/HangfireIO/Hangfire/issues?state=open). Detailed reports with stack traces, actual and expected behavours are welcome. \n\nLicense\n--------\n\nHangfire.Azure.ServiceBusQueues is released under the [MIT License](http://www.opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhangfireio%2Fhangfire.azure.servicebusqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhangfireio%2Fhangfire.azure.servicebusqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhangfireio%2Fhangfire.azure.servicebusqueue/lists"}