Developer forum

Forum » Development » NotificationSubscriber

NotificationSubscriber


Reply
I have a problem with a custom module ive developed. in this module i try to use the notificationsubscriber to run some code on paragraph.saved
This works on some solutions i install the module in but not all and i wonder what could affect this.

Do anybody have an idea why this only works sometimes?


[

Subscribe(Standard.Paragraph.Saved)]
public class BorgerDkNotificationSubscriber : NotificationSubscriber
{

File
.AppendAllText(HttpContext.Current.Server.MapPath("~/Files/Log.txt"), "en anden hest \n");
}

Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
That code should not work at all. You need to override the OnNotify method. Have a look at the this document, which among other things describes the extensibility concepts. Especially have a look at chapter 8: http://engage.dynamicweb-cms.com/Admin/Public/Download.aspx?File=Files%2fFiler%2fDocumentation%2fDevelopment%2feCommerce%2f(en-US)+eCommerce+Extensibility+API%2c++Dynamicweb+eCommerce.pdf

- Jeppe
 
Reply
you are right but it was my copy paste into this editor that delete something it actually looks like this:

[

Subscribe(Standard.Paragraph.Saved)]
public class BorgerDkNotificationSubscriber : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
File.AppendAllText(HttpContext.Current.Server.MapPath("~/Files/Log.txt"), "en anden hest \n");
}
}
 
Reply
 The notification was added in 7.1 - it will not work on older solutions
 
Reply
ive installed this module on solution that is in version 19.1.1.0 and it doesnt work on but on another solution with the same version it does work.
 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
That looks a lot better :-)

I can think of two scenarios here:

1) It's a permission issue where one solution doesn't have read/write access to the file, you're trying to edit. Try doing a Response.End() instead to see if the NotificationSubscriber is actually being invoked.

2) The dll containing the NotificationSubscriber is not being loaded on one solution. Have a look at this forum post: http://engage.dynamicweb-cms.com/Forum-5.aspx?action=ShowThread&ThreadID=2053

- Jeppe

 

You must be logged in to post in the forum