Open Closed

Abp Background Job #4918


User avatar
0
DominaTang created
  • ABP Framework version: v4.1
  • UI type: Angular
  • DB provider: EF Cor
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

After Enqueue a job request to JobManager, AbpBackgroundJobs table, that request IsAbandoned flag is set to 1. If add delay parameter to Enqueue method, say 3 minutes, Job record in AbpBackgroundJobs, the IsAbandoned value is 0, and three minutes later, the IsAbandoned value is 1

It seems that the JobManager can not locate the Job class successfully? How to job manager can locate the corresponding job to handle the parameter? I tried to add jobName attribute to EmailNotificationArgs class, but it doesn't work. There is exception in Log file neither.

"public class PartyCompleteEmailJob : AsyncBackgroundJob<EmailNotificationArgs>, ITransientDependency"

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    I don't quite understand what you mean. can you explain it in detail?

    public class TestAppService : MyProjectNameAppService
    {
        private readonly IBackgroundJobManager _backgroundJobManager;
    
        public TestAppService(IBackgroundJobManager backgroundJobManager)
        {
            _backgroundJobManager = backgroundJobManager;
        }
    
        public async Task SendDelayEmail()
        {
            await _backgroundJobManager.EnqueueAsync<EmailNotificationArgs>(
                new EmailNotificationArgs { Email = "test", Subject = "test", Body = "test" },
                delay: TimeSpan.FromMinutes(3));
        }
    }
    
    public class EmailNotificationArgs
    {
        public string Email { get; set; }
        public string Subject { get; set; }
        public string Body { get; set; }
    }
    
    public class PartyCompleteEmailJob : AsyncBackgroundJob<EmailNotificationArgs>, ITransientDependency
    {
        public override Task ExecuteAsync(EmailNotificationArgs args)
        {
            Logger.LogInformation("------------- Sending email to " + args.Email + " with subject " + args.Subject + " and body " +
                                  args.Body + "");
            return Task.CompletedTask;
        }
    }
    

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.