I'm receiving a callback from a component (rabbitmq) in a static class. There is no session (IAbpSession) object associated with the current operating context, nor is there a current HttpContext. I'd like to be able to send a message to all user's in a known tenancy. My code appears as follows:
[UnitOfWork] public static void NotifyUsers(int tenantId, string msg) { // Get the publisher var publisher = IocManager.Instance.Resolve<INotificationPublisher>(); // Notify the user if (publisher != null) { // publish notification to all users in tenancy publisher.PublishAsync( notificationName: "notifyName", data: new MessageNotificationData(msg), severity: NotificationSeverity.Info, tenantIds: new int?[] { tenantId } ); } }
Can someone tell me why this isn't working and how to fix it?
If I set the userIds the code works and sends the notifications.
Many thanks, Gerry
2 Answer(s)
-
0
I think it has to do with not having a UnitOfWork or not having the UnitOfWork restricted to a given tenancy. Any help here would be greatly appreciated.
Thanks!
-
0
Did you subscribe? See https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2135.