{"id":16640294,"url":"https://github.com/yuzd/hangfire.httpjob","last_synced_at":"2025-05-14T21:10:47.952Z","repository":{"id":33791261,"uuid":"135046565","full_name":"yuzd/Hangfire.HttpJob","owner":"yuzd","description":"httpjob for Hangfire,restful api for Hangfire,job调度与业务分离","archived":false,"fork":false,"pushed_at":"2024-08-27T01:19:57.000Z","size":1395,"stargazers_count":643,"open_issues_count":16,"forks_count":189,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-05-11T08:37:12.772Z","etag":null,"topics":["hangfire","job","job-portal","job-scheduler"],"latest_commit_sha":null,"homepage":"https://github.com/yuzd/Hangfire.HttpJob/wiki","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/yuzd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-05-27T12:59:32.000Z","updated_at":"2025-04-20T15:31:13.000Z","dependencies_parsed_at":"2024-04-08T10:24:39.946Z","dependency_job_id":"d35ace76-df53-4094-81ed-115c87036d5d","html_url":"https://github.com/yuzd/Hangfire.HttpJob","commit_stats":{"total_commits":236,"total_committers":17,"mean_commits":"13.882352941176471","dds":0.6483050847457628,"last_synced_commit":"4e26e2298e68fe8476fa2408afda04297df284eb"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuzd%2FHangfire.HttpJob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuzd%2FHangfire.HttpJob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuzd%2FHangfire.HttpJob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuzd%2FHangfire.HttpJob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuzd","download_url":"https://codeload.github.com/yuzd/Hangfire.HttpJob/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254227631,"owners_count":22035671,"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":["hangfire","job","job-portal","job-scheduler"],"created_at":"2024-10-12T07:08:23.903Z","updated_at":"2025-05-14T21:10:42.937Z","avatar_url":"https://github.com/yuzd.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Hangfire.HttpJob for .netcore\n================================\n\nHangfire.HttpJob for Hangfire\n\n1. add delay background job by [http post] or on dashbord\n2. add recurring job by [http post] or on dashbord\n3. search job by jobname on dashbord\n4. stop or start job on dashbord\n5. cron generator on dashbord\n6. use Hangfire.HttpJob.Agent extention to quick develop job program\n\n   6.1 Make your webjob very convenient to support scheduling execution\n   \n   6.2 Visualizing the execution process of webjob by logs and progress on hangfire dashbord\n   \n   6.3 Variety of webjob types with different life cycles\n   \n   \t6.3.1 Singleton\n\t\n\t6.3.2 Transient \n\t\n\t6.3.3 Hang up until stop command\n\t\n\n# wiki\n\n00.QickStart DockerQuickStart\n\n01.how to create backgroud httpjob\n\n02.how to create recurringHttpJob\n\n03.how to use HttpJob.Agent\n\n04.how to use in sqlserver\n\n05.how to config mail service to report job result\n\nhttps://github.com/yuzd/Hangfire.HttpJob/wiki\n\nInstallation\n-------------\n\nThis library is available as a NuGet Package:\n\n```\nInstall-Package Hangfire.HttpJob\n\nInstall-Package Hangfire.HttpJob.Agent\n\nInstall-Package Hangfire.HttpJob.Client\n```\n\nUsage\n------\n\n## \n\n```csharp\n\t//StartUp.cs\n \n\tpublic virtual void ConfigureServices(IServiceCollection services)\n\t{\n\t\tservices.AddHangfire(Configuration);//Configuration是下面的方法\n\t}\n\n\tprivate void Configuration(IGlobalConfiguration globalConfiguration)\n\t{\n\t\tglobalConfiguration.UseStorage(\n\t\t\t\tnew MySqlStorage(\n\t\t\t\t\t\"Server=localhost;Port=3306;Database=hangfire;Uid=root;Pwd=123456;charset=utf8;SslMode=none;Allow User Variables=True\",\n\t\t\t\t\tnew MySqlStorageOptions\n\t\t\t\t\t{\n\t\t\t\t\t\tTransactionIsolationLevel = IsolationLevel.ReadCommitted,\n\t\t\t\t\t\tQueuePollInterval = TimeSpan.FromSeconds(15),\n\t\t\t\t\t\tJobExpirationCheckInterval = TimeSpan.FromHours(1),\n\t\t\t\t\t\tCountersAggregateInterval = TimeSpan.FromMinutes(5),\n\t\t\t\t\t\tPrepareSchemaIfNecessary = false,\n\t\t\t\t\t\tDashboardJobListLimit = 50000,\n\t\t\t\t\t\tTransactionTimeout = TimeSpan.FromMinutes(1),\n\t\t\t\t\t}))\n\t\t\t.UseConsole()\n\t\t\t.UseHangfireHttpJob();\n\t}\n\n\tpublic void Configure(IApplicationBuilder app)\n\t{\n\t\tapp.UseHangfireServer();\n\t\tapp.UseHangfireDashboard(\"/hangfire\",new DashboardOptions\n\t\t{\n\t\t\tAuthorization = new[] { new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions\n\t\t\t{\n\t\t\t\tRequireSsl = false,\n\t\t\t\tSslRedirect = false,\n\t\t\t\tLoginCaseSensitive = true,\n\t\t\t\tUsers = new []\n\t\t\t\t{\n\t\t\t\t\tnew BasicAuthAuthorizationUser\n\t\t\t\t\t{\n\t\t\t\t\t\tLogin = \"admin\",\n\t\t\t\t\t\tPasswordClear =  \"test\"\n\t\t\t\t\t} \n\t\t\t\t}\n\n\t\t\t}) }\n\t\t});\n\t}\n```\n# add Hangfire HttpJob by client\n\n``` \n    Install-Package Hangfire.HttpJob.Client\n\n    var serverUrl = \"http://localhost:5000/job\";\n    var result = HangfireJobClient.AddBackgroundJob(serverUrl, new BackgroundJob\n    {\n\tJobName = \"测试api\",\n\tMethod = \"Get\",\n\tUrl = \"http://localhost:5000/testaaa\",\n\tMail = new List\u003cstring\u003e {\"1877682825@qq.com\"},\n\tSendSucMail = true,\n\tDelayFromMinutes = 1\n    }, new HangfireServerPostOption\n    {\n\tBasicUserName = \"admin\",\n\tBasicPassword = \"test\"\n    });\n    \n    var result = HangfireJobClient.AddRecurringJob(serverUrl, new RecurringJob()\n    {\n\tJobName = \"测试5点40执行\",\n\tMethod = \"Post\",\n\tData = new {name = \"aaa\",age = 10},\n\tUrl = \"http://localhost:5000/testpost\",\n\tMail = new List\u003cstring\u003e { \"1877682825@qq.com\" },\n\tSendSucMail = true,\n\tCron = \"40 17 * * *\"\n    }, new HangfireServerPostOption\n    {\n\tBasicUserName = \"admin\",\n\tBasicPassword = \"test\"\n    });\n```\n\nHow to add Hangfire.HttpJob by restful api\n================================\n1.add backgroundjob\n\n```\nurl:http://{hangfireserver}/hangfire/httpjob?op=backgroundjob\nmethod:post\ndata:\n{\n  \"Method\": \"POST\",\n  \"ContentType\": \"application/json\",\n  \"Url\": \"http://XXXXXXX\",\n  \"DelayFromMinutes\": 1,\n  \"Data\": \"{\\\"userName\\\":\\\"test\\\"}\",\n  \"Timeout\": 5000,\n  \"BasicUserName\": \"\",// 如果你希望hangfire执行http的时候带basic认证的话 就设置这2个参数\n  \"BasicPassword\": \"\",\n  \"JobName\": \"test_backgroundjob\"\n}\n```\n\n2.add recurringjob\n\n```\nurl:http://{hangfireserver}/hangfire/httpjob?op=recurringjob\nmethod:post\ndata:\n{\n  \"Method\": \"POST\",\n  \"ContentType\": \"application/json\",\n  \"Url\": \"http://XXXXXXX\",\n  \"Data\": \"{\\\"userName\\\":\\\"test\\\"}\",\n  \"Timeout\": 5000,\n  \"Corn\": \"0 12 * */2\",\n  \"BasicUserName\": \"\",// 如果你希望hangfire执行http的时候带basic认证的话 就设置这2个参数\n  \"BasicPassword\": \"\",\n  \"JobName\": \"test_recurringjob\"\n}\n```\n\nHow to add Hangfire.HttpJob  in Dashbord\n================================\n![image](https://images4.c-ctrip.com/target/zb0k14000000wk58p27A6.png)\n![image](https://images4.c-ctrip.com/target/zb0p14000000wf3q84C46.png)\n![image](https://images4.c-ctrip.com/target/zb0114000000wsw9f5E9F.png)\n![image](https://images4.c-ctrip.com/target/zb0u14000000wfy2cBA74.png)\n![image](https://images4.c-ctrip.com/target/zb0814000000wg66eDEB1.png)\n![image](https://images4.c-ctrip.com/target/zb0p14000000wf3yn5CC8.png)\n![image](https://images4.c-ctrip.com/target/zb0c14000000wimqtC772.png)\n## Email notify\n![image](https://images4.c-ctrip.com/target/zb0514000000wihim765F.png)\n\n## Thanks for the Rider IDE provided by JetBrains\n[![](https://images4.c-ctrip.com/target/zb021d000001ed9clDFB6.png)](https://www.jetbrains.com/?from=Hangfire.HttpJob)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuzd%2Fhangfire.httpjob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuzd%2Fhangfire.httpjob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuzd%2Fhangfire.httpjob/lists"}