Open Closed

Abp Background Job is not triggered #5139


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:

Try the sample code provided by Abp support: 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; } }

Trigger SendDelayEmail() via Swagger twice, from database The abandon column at the beginning is 0, wait a while. The Abandon will have value 1 Add a break point to ExecuteAsync(EmailNotificationArgs args) method, the break point is never reached.


3 Answer(s)
  • User Avatar
    0
    jfistelmann created

    Hey,

    I tried to reproduce the issue with the latest version of abp (7.2.2 as of today) and I could not reproduce the issue. I implemented it as described here: https://github.com/nebula2/abp-qa-5139

    Can you please check if the issue occurs using the latest version?

    kind regards Jack

  • User Avatar
    0
    DominaTang created

    Hey,

    I tried to reproduce the issue with the latest version of abp (7.2.2 as of today) and I could not reproduce the issue. I implemented it as described here: https://github.com/nebula2/abp-qa-5139

    Can you please check if the issue occurs using the latest version?

    kind regards Jack

    Hi,

    The Abp version is 4.1.0 I created a new solution, and make the request 10 times, 8 requests are abandoned. Two requests are executed.

    Thanks, Domina

  • User Avatar
    0
    jfistelmann created

    Hey,

    I tried to reproduce the issue with the latest version of abp (7.2.2 as of today) and I could not reproduce the issue.
    I implemented it as described here: https://github.com/nebula2/abp-qa-5139

    Can you please check if the issue occurs using the latest version?

    kind regards
    Jack

    Hi,

    The Abp version is 4.1.0 I created a new solution, and make the request 10 times, 8 requests are abandoned. Two requests are executed.

    Thanks, Domina

    Sadly, version 4.1.0 is outdated (it was released January 2021. There have been some changes and it seems like the issue you are describing got fixed in the meantime. Using version 7.2.2 - I changed the delay to 15 seconds in order to reproduce faster and made 10 requests. They all went through:

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11