![]() Var senderUser = _userRepository.Get(args.SenderUserId) Public override void Execute(SimpleSendEmailJobArgs args) ![]() Public SimpleSendEmailJob(IRepository userRepository, IEmailSender emailSender) Private readonly IEmailSender _emailSender Private readonly IRepository _userRepository Queue: public class SimpleSendEmailJob : BackgroundJob, ITransientDependency Let's define a more realistic job which sends emails in a background ![]() ITransientDependency is the simplest way. The argument type is defined as a generic classĪ background job must be registered via dependency Public override async Task ExecuteAsync(int number)Ī background job defines an Execute or ExecuteAsync method that gets an inputĪrgument. Here is the most simple async background job: public class TestJob : AsyncBackgroundJob, ITransientDependency Here is the most simple background job: public class TestJob : BackgroundJob, ITransientDependency We can create a background job class by either inheriting from theīackgroundJob class or AsyncBackgroundJob class or by directly implementing the See the Background Job Store section for more information on job Overcome temporary failures and guarantee that itĮventually will be sent. For example, you can send emails in a background job to To create re-trying and persistent tasks to guarantee code will be successfullyĮxecuted.You add this job to the queue and send the report's result to User presses a 'report' button to start a long-running reporting ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |