Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I'm a little stuck here trying to get Hangfire calling a service.
How do I inject til RitzauService correctly ?
I'm using cultivhangfire package
Just thought I Had it.. But this didn't work..
Hi Thomas,
I am not sure if I understand correctly what you are trying to do, but this is the way I implemented a custom service to be used by Hangfire:
public class HangfireTasksComposer : IComposer { public void Compose(IUmbracoBuilder builder) { builder.Services.AddScoped<IRitzauService, RitzauService>(); RecurringJob.AddOrUpdate<IRitzauService>(x => x.SyncRitzau(null), Cron.Daily()); } } public interface IRitzauService { void TaskToPerform(PerformContext context); } public class RitzauService : IRitzauService { public void SyncRitzau(PerformContext context) { // Perform the task } }
I hope this is any help.
regards, Frans
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Umbraco 9 Hangfire Inject Service to Composer
Hi
I'm a little stuck here trying to get Hangfire calling a service.
How do I inject til RitzauService correctly ?
I'm using cultivhangfire package
Just thought I Had it.. But this didn't work..
Hi Thomas,
I am not sure if I understand correctly what you are trying to do, but this is the way I implemented a custom service to be used by Hangfire:
I hope this is any help.
regards, Frans
is working on a reply...