Hi,
Similar to User Import that you have in ASPNetZero, we have created one more import to import masters data. We are using ASPNetZero Background Job for import. Once the job is finished execution, we are sending notification to the user.
Simple Message
If the import is initiated by the admin user of tenant, the notification comes and all seems ok. But, if I create one more user for the tenant and then initiate the process of import, the notification never comes up.
Pub/Sub
The above issue is occuring for pub/sub type of message as well. I mean in case of pub/sub also, only admin user of tenant is getting the notification and not the other user. I checked, both the user has subscribed for the notification
But surprisingly, in case of pub/sub, if I don't specify the user (something like below), then both the user gets the notification.
await _notificationPublisher.PublishAsync(AppNotificationNames.ExcelImportStatus, notificationData);
But if I specify the user (the other user than the admin of the tenant)(something like below), then this user does not get notification
await _notificationPublisher.PublishAsync(AppNotificationNames.ExcelImportStatus, notificationData, userIds: new[] { argsUser });
and if I specify the user (i.e. admin of the tenant)(something like below), then this user does get notification
await _notificationPublisher.PublishAsync(AppNotificationNames.ExcelImportStatus, notificationData, userIds: new[] { argsUser });
During my debugging, I could see that notification data are getting inserted in AbpTenantNotifications and AbpUserNotifications tables. But below code of front end does not trigger (in case of user other than the admin. In case of admin it triggers).
abp.event.on('abp.notifications.received', userNotification => { debugger; self._zone.run(() => { onNotificationReceived(userNotification); }); });
The question is why the other user is not getting the notification (either Simple or pub/sub), if the notification is targetted to a specific user.
Regards, Mahendra
7 Answer(s)
-
0
Hi Expert,
Any thought on my above query...
Regards, Mahendra
-
0
Hi @mahendra
Could you share your BackgroundJob code with us ?
Thanks,
-
0
Hi ismcagdas,
Please find attach the class file for background job. I am also attaching the appNotifier class (I thought you may require it to see the failure notification).
- Brief about Background Job Class file
In the Background job, we are essentially importing the master data from excel that user has imported.
Actual import happens in "ImportExcelData" function from where, corresponding master AppService method is called. Once import is done (that is control returned from corresponding master AppService, we are calling "ProcessImportStatus" method.
Inside "ProcessImportStatus" method, conditionally we are sending success notification or failure notification.
Below line is for failure notification.
await _appNotifier.ExcelImportStatus(args.User, file.FileToken, file.FileType, file.FileName);
and below line is for success notification.
await _appNotifier.SendMessageAsync( args.User, "Data Imported Successfully :" + args.ExcelFileName, //_localizationSource.GetString("SuccessfullyImportedFromExcel"), Abp.Notifications.NotificationSeverity.Success);
-
0
Didn't see any option to attch the files....
I am sending an email with attachement requested...
Regards, Mahendra
-
0
Hi,
Any update on my ticket please?
Regards, Mahendra
-
0
Hi @mahendra
Please follow https://github.com/aspnetzero/aspnet-zero-core/issues/3597.
We will work on this in a short time.
-
0
Hi @mahendra
I could not reproduce the problem. Can you please share a demo project that contains that problem?