{"id":15039051,"url":"https://github.com/rabbicse/mehedi.hangfire.extensions","last_synced_at":"2025-04-15T09:27:07.052Z","repository":{"id":239732212,"uuid":"800291215","full_name":"rabbicse/mehedi.hangfire.extensions","owner":"rabbicse","description":"Useful extension methods to be able to use Hangfire to create background jobs. ","archived":false,"fork":false,"pushed_at":"2025-02-05T08:36:31.000Z","size":97,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T18:50:59.747Z","etag":null,"topics":["asynchronous","csharp","dotnetcore","hangfire","postgres"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rabbicse.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-05-14T04:03:28.000Z","updated_at":"2025-02-05T08:36:35.000Z","dependencies_parsed_at":"2024-05-20T07:26:11.749Z","dependency_job_id":"4b25f6fe-f22f-487a-b0ac-be3937f74774","html_url":"https://github.com/rabbicse/mehedi.hangfire.extensions","commit_stats":null,"previous_names":["rabbicse/mehedi.hangfire.extensions"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbicse%2Fmehedi.hangfire.extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbicse%2Fmehedi.hangfire.extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbicse%2Fmehedi.hangfire.extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbicse%2Fmehedi.hangfire.extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rabbicse","download_url":"https://codeload.github.com/rabbicse/mehedi.hangfire.extensions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249041950,"owners_count":21203191,"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":["asynchronous","csharp","dotnetcore","hangfire","postgres"],"created_at":"2024-09-24T20:41:22.820Z","updated_at":"2025-04-15T09:27:07.030Z","avatar_url":"https://github.com/rabbicse.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Nuget](https://img.shields.io/nuget/v/Mehedi.Hangfire.Extensions)](https://www.nuget.org/packages/Mehedi.Hangfire.Extensions/)\n[![Nuget](https://img.shields.io/nuget/dt/Mehedi.Hangfire.Extensions)](https://www.nuget.org/packages/Mehedi.Hangfire.Extensions/)\n\n# Mehedi.Hangfire.Extensions\nUseful extension methods to be able to use Hangfire to create background jobs. \n\n## Give a Star! :star:\nIf you like this project, learn something or you are using it in your applications, please give it a star. Thanks!\n\n## Installation\n\nInstall the package via NuGet first:\n\n```Install-Package Mehedi.Hangfire.Extensions```\n\nOr via the .NET Core command line interface:\n\n```dotnet add package Mehedi.Hangfire.Extensions```\n\nEither commands, from Package Manager Console or .NET Core CLI, will download and install package and all required dependencies.\n\n## Getting Started with ASP.NET Core API\n\n### Step 1\nCreate ASP.NET Core API project. Then install the following dependencies with the following commands.\n```\ndotnet add package Hangfire.AspNetCore\ndotnet add package Mehedi.Hangfire.Extensions\n```\n\n### Step 2\nTo store messages we'll need databases. For an example if we want to store messages (http requests etc.) inside postgres, add the following package.\n```\ndotnet add package Hangfire.PostgreSql\n```\n\n### Step 3\nUpdate `appsettings.json` with postgres connection string.\n```\n  \"ConnectionStrings\": {\n    \"HangfireConnection\": \"Host=localhost;Port=5432;Database=hangfire;Username=postgres;Password=postgres;\"\n  },\n```\n\n### Step 4\nInside `Program.cs` file write the following code snippets.\n```csharp\nbuilder.Services.AddHangfire(config =\u003e\n{\n    config.UsePostgreSqlStorage(c =\u003e c.UseNpgsqlConnection(builder.Configuration.GetConnectionString(\"HangfireConnection\")));\n    config.UseMediatR(); // Custom extension built on \n});\nbuilder.Services.AddHangfireServer();\n```\n\nand\n\n```csharp\napp.UseHangfireDashboard();\n```\n### Step 5\nAdd PlaceOrder class as the following code snippet\n```csharp\npublic class PlaceOrder : IRequest\n{\n    public Guid OrderId { get; set; }\n}\n```\n\n### Step 6\nInside Controller simply enque requests like the following code snippets as an example.\n```csharp\n    [HttpPost(\"/sales/orders/{orderId:Guid}\")]\n    public IActionResult Action([FromRoute] Guid orderId)\n    {\n        _mediator.Enqueue(\"Place Order\", new PlaceOrder\n        {\n            OrderId = orderId\n        });\n\n        return Ok($\"Job created\");\n    }\n```\n\nIf you face any more complexity, then just follow the example project to getting started.\n[Example](https://github.com/rabbicse/mehedi.hangfire.extensions/tree/master/examples/Hangfire.Extensions.Example)\n\n## Dependencies\n- net8.0\n- Hangfire.Core (\u003e= 1.8.12)\n- MediatR (\u003e= 12.2.0)\n\n## References\n- [Hangfire](https://www.hangfire.io/)\n- [Using Hangfire and MediatR as a Message Dispatcher](https://codeopinion.com/using-hangfire-and-mediatr-as-a-message-dispatcher/)\n- [Hangfire Postgres](https://github.com/hangfire-postgres)\n- [Integrate MediatR with Hangfire](https://github.com/AliBayatGH/CommandScheduler)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabbicse%2Fmehedi.hangfire.extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frabbicse%2Fmehedi.hangfire.extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabbicse%2Fmehedi.hangfire.extensions/lists"}