Hi,
In our application I created a scheduling app. Now I want to send a notification (not an email but an in app notification) to a user 5 minutes before an event starts. I don't see an easy way to do this. Any tips are much appreciated.
(I'm using the .net core version with jquery)
Regards, Robrecht
2 Answer(s)
-
0
@robrechtbelien , have you looked at background tasks to accomplish this? See https://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers You can add a BackgroundJob at any time, you would just need to calculate offset from Clock.Now until the start of your event, minus 5 minutes. I am doing something similar in my app.
Take a look at **Abp.BackgroundJobs.BackgroundJobManager, EnqueueAsync() method: **
[UnitOfWork] public virtual async Task<string> EnqueueAsync<TJob, TArgs>(TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null) where TJob : IBackgroundJob<TArgs> { var jobInfo = new BackgroundJobInfo { JobType = typeof(TJob).AssemblyQualifiedName, JobArgs = args.ToJsonString(), Priority = priority }; if (delay.HasValue) { jobInfo.NextTryTime = Clock.Now.Add(delay.Value); } await _store.InsertAsync(jobInfo); await CurrentUnitOfWork.SaveChangesAsync(); return jobInfo.Id.ToString(); }
-
0
addition to @dnard82's answer: you can send notification inside your background job. see https://aspnetboilerplate.com/Pages/Documents/Notification-System