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

INotificationPublisher not working for send to all users in tenancy #5891


User avatar
0
gerryp created

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)
  • User Avatar
    0
    gerryp created

    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!

  • User Avatar
    0
    aaron created
    Support Team

    Did you subscribe? See https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2135.