Reputation: 141
I have been using Hang-fire in our project but had a question, Can i call a hangfire Recurring Job from an API?
For Example: http://devmyproject.com/projectname/recurring is the url for Hangfire web application to get recurring job. Now from my webApi project i want to call this Url and invoke a Job to run. Is this Possible?
Thanks
Upvotes: 1
Views: 3744
Reputation: 141
In The HangFire Project i added an end points to make it an API to get the Requests and then run the Hangfire job. I added Fire and Forget Job to run the HangFire job.
Upvotes: 1
Reputation: 1439
Yes you can certainly perform hangfire functions by calling an API. Here is the function for creating a Hangfire job as listed on the front page of hangfire site.
RecurringJob.AddOrUpdate(
() => Console.WriteLine("Recurring!"),
Cron.Daily);
The URL you call should be an endpoint which you can pass parameters to. Then if hangfire is set up correctly it should be like any other application.
Upvotes: 0