Base solution for your next web application
Open Closed

Periodic Background Work - Send Notification #6204


User avatar
0
maharatha created

I am trying to run a back ground job to send notification to users. Whatever I write it doesn't work. Can you guide me on how to write. My sample code :

 using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant))
            {
                var objectstoRetrieve = _objectRetrievalStatusLogRepository.GetAll().Where(/*p => p.ExpectedAvailableDateTime > Clock.Now && */p => p.IsAvailable == false);
                var oneMonthAgo = Clock.Now.Subtract(TimeSpan.FromDays(30));

                foreach (var objecttoRetrieve in objectstoRetrieve)
                {
                    UserIdentifier userIdentifier =
                        new UserIdentifier(objecttoRetrieve.TenantId, objecttoRetrieve.CreatorUserId.Value);

                    _appNotifier.SendObjectAvailabilityMessageAsync(userIdentifier, Guid.NewGuid().ToString(),
                        NotificationSeverity.Success);

                }

               

            }

Am I missing something here ?


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    First check if there is any relevant information in the log.

    Then the SendObjectAvailabilityMessageAsync method needs await?