Developer forum

Forum » Dynamicweb 10 » NotificationSubscribers not triggering in DW10

NotificationSubscribers not triggering in DW10

Arnór Halldórsson
Arnór Halldórsson
Reply

Sup guys,

We're having troubles triggering notification subscribers in dw 10.

I've tried both of these cases:

 
using Dynamicweb.Extensibility.Notifications;
 
public class TestNotificationSubscriber : NotificationSubscriber
{
    [Subscribe(Dynamicweb.Notifications.Standard.User.OnExtranetLogin)]
    public override void OnNotify(string notification, NotificationArgs args)
    {
        Console.WriteLine($"Notification: {notification}");
    }
}

and

using Dynamicweb.Extensibility.Notifications;
 
public class TestNotificationSubscriber : NotificationSubscriber
{
    public override void OnNotify(string notification, NotificationArgs args)
    {
        Console.WriteLine($"Notification: {notification}");
    }
}

The class is located right next to Program.cs in the root of my project:

Am I reaching max potato levels here or is something afoot?


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

The Subscribe attribute should be added to the class - not the method.
Note: OnExtranetLogin notification will only be triggered on successful login.

[Subscribe(Dynamicweb.Notifications.Standard.User.OnExtranetLogin)]
public class TestNotificationSubscriber : NotificationSubscriber
{
    public override void OnNotify(string notification, NotificationArgs args)
    {
        Console.WriteLine($"Notification: {notification}");
    }
}
Votes for this answer: 1
 
Arnór Halldórsson
Arnór Halldórsson
Reply

Of course... I will never repurationally recover from this xD 

Thanks Morten, works like a charm!

 

You must be logged in to post in the forum