Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Notification not sent #3520


User avatar
0
imad created

Hi,

I need to send a notification from an ApplicationService defined in a custom module, I successfully managed to add a new notification type to the default AppNotificationProvider defined in the core module, but when I try to replicate the same in another module the notification wont show up, even its not save in the database.

So in my custom module i have the following:

  1. Defined a new NotificationProvider and registered it to Configuration.Notifications.Providers in module PreInitialize, its now successfully shown in the list of available notification to the user in Notification Settings. 2.Defined a new AppNotifier similar to the one in the core module that uses the _notificationPublisher.PublishAsync 3.From my custom application service i invoke await _appNotifier.NewDataProjectCreatedAsync(dataProject);

I got no error and yet the notification is not saved in the database and of course not sent to the client, even the user is subscribed to this type of notification.

What i am missing do i need to call _notificationSubscriptionManager.SubscribeToAllAvailableNotificationsAsync before i invoke the method on appNotifier like in the AccountController?

Thank you.


8 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    which version are you using?

    can you double check the steps mentioned here

    <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Notification-System">https://aspnetboilerplate.com/Pages/Doc ... ion-System</a>

  • User Avatar
    0
    alper created
    Support Team

    notification system deletes data from database as soon as it's sent to user. so can you open a sql profiler and see if there's log that tries to make database insertion.

  • User Avatar
    0
    imad created

    Hi I am using version 2.0.1,

    While looking at the profiler, i see the following execution queries:

    1.INSERT [dbo].[AbpNotifications] 2.INSERT [dbo].[AbpBackgroundJobs] 3.Select FROM [dbo].[AbpBackgroundJobs] 4.Select FROM [dbo].[AbpNotifications] 5.Select FROM [dbo].[AbpNotificationSubscriptions] (returns 1 row) 6.DELETE [dbo].[AbpNotifications] 7.DELETE [dbo].[AbpBackgroundJobs]

    There is no insert into AbpTenantNotifications or AbpUserNotifications where others notifications usually are.

    Thank you.

  • User Avatar
    0
    imad created

    Any Help, or guidance? is this a bug or i am missing something in the steps?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @imad,

    It seems like, target users are not subscribed to this notification. It is hard to understand the cause of problem without looking at your project.

    Do you use latest version of ABP framework in your project ? If so, can you send your project to us, so we can check it for you.

    Thanks.

  • User Avatar
    0
    imad created

    Hi,

    This is the first point i suspected, but as you can see step N-5 there is one users subscribed to this event.

    and here is the table AbpNotificationSubscriptions UserId NotificationName 2 App.NewDataSourceCreated 2 App.UserSignedIn 2 App.NewUserRegistered 2 App.NewDataProjectCreated 2 App.NewDashboardCreated

    I am successfully receiving notification for App.UserSignedIn because its defined in the Core module AppNotifier.

    And Sorry i cant share my project. Thank you.

  • User Avatar
    0
    imad created

    Hi,

    After further testing, if i remove the permissionDependency from my NotificationDefinition, I successfully receive the notification, although I am sure that the current user has the required permission when i enable the permission dependency the notification is not sent.

    If the assigned permissions has multiTenancySides it will not work, if i remove the multiTenancySides on permission creation the notification is sent.

    Hope this will help with the troubleshooting. Thank you.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @imad,

    This information is very helpful. We will try to solve this problem in a short time.

    Thanks.