Hello, I configure my app to run with HangFire(Asp.net zero 4.3, I use HangFire sync. between DB1 and DB2). I can see a job being enqueued. The job is making use of the NotificationPublisher to send a notification to a specific user (testing purpose). The user is never receiving those notifications.
I debugged the code and it works fine.
I also checked the AbpTenantNotifications, it seems those notifications used are not added to the DB.
WebModule Configuration.BackgroundJobs.UseHangfire(configuration => { configuration.GlobalConfiguration.UseSqlServerStorage("Default"); });
Startup app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) } });
Code: Select all public class TestingHangFireDomainService : DrcAppDomainServiceBase, ITestingHangFireDomainService { private readonly IAppNotifier _appNotifier; private readonly IUnitOfWorkManager _unitOfWorkManager; private readonly UserManager _userManager;
public TestingHangFireDomainService(IAppNotifier appNotifier, UserManager userManager, IUnitOfWorkManager unitOfWorkManager)
{
_appNotifier = appNotifier;
_unitOfWorkManager = unitOfWorkManager;
_userManager = userManager;
}
public async Task NotifyUser()
{
using (_unitOfWorkManager.Begin())
{
var user = _userManager.Users.Where(u => u.Id == 2).FirstOrDefault();
await _appNotifier.SendMessageAsync(user.ToUserIdentifier(), "Testing HangFire", Abp.Notifications.NotificationSeverity.Info);
}
}
}
Regards, zepan
1 Answer(s)
-
0
add virtual to NotifyUser method
public virtual async Task NotifyUser()