Customizing Alert and Notification

The alert and notification system is built with an extensible architecture.

Adding new Periodic Alert

To add a custom alert, follow the below mentioned steps:

  1. Create a class library in .NET 6.0 version.
  2. Add a reference to below dlls. They are available at the location “<<AssistEdge>>\app\Vanguard\”.
    1. Quartz.dll
    2. Quartz.Serialization.Json.dll
    3. EV.AE.Vanguard.MonitorPeriodic.Core.dll
    4. EV.AE.Utilities.Logging.Core.dll
    5. EV.AE.Utils.Core.dll
       
  3. Implement the abstract class PeriodicJobBase from EV.AE.Vanguard.MonitorPeriodic.Core.dll.
  4. Pass all the required dependencies of the job through constructor, declare all the dependencies as private read-only variables and extend PeriodicJobBase base class constructor with ILogging and IDAlClient dependencies:

  5. Class name must same as the job “Type” in “<<AssistEdge>>\app\Vanguard\Monitor\PeriodicXml\MonitorAlerts.xml” file.



  6. Details of the ExecuteJob Method.
    1. Input parameter (IJobExecutionContext context) – This is the configuration list and RepeatInterval provided in “<<AssistEdge>>\app\Vanguard\Monitor\PeriodicXml\MonitorAlerts.xml” file.
      To access configurations, use below sample.


       
    2. Output parameter (string) - The method returns a string with an alert description. This is an input to email notification.
       

      NOTE: 

      If there is no need to raise an alert, then return an empty string.

  1. Build the DLL in Release, AnyCPU mode. Place the DLL at “<<AssistEdge>>\app\Vanguard\” location.
  2. Take backup of EV.AE.Vanguard.Core.deps.json.
  3. Update EV.AE.Vanguard.Core.deps.json with entries required for the new custom dll and its dependencies dlls. You can refer EV.AE.Vanguard.Monitor.PeriodicJobs.Core dll entry present in EV.AE.Vanguard.Core.deps.json file. Entries should be done in section
    1. targets -> .NETCoreApp,Version=v6.0 -> EV.AE.Vanguard.Core/1.0.0 -> dependencies
    2. targets -> .NETCoreApp,Version=v6.0
    3. libraries

 

Adding new Formatter

By default, an email notification type is sent when an alert is raised. A custom formatter can also be configured. Follow the below steps to add a custom formatter.

  1. Create a class library in .NET 6.0 version.
  2. Add a reference to below dlls. They are available at the location “<<AssistEdge>>\app\Vanguard\”.
    1. EV.AE.Utilities.EntityModels.Core.dll
    2. EV.AE.Utilities.Interfaces.Core.dll
  3. Implement Interface IAlertFormatter in the class. It is present in namespace EV.AE.Utilities.Interfaces.Core.Vanguard.
  4. Create empty default constructor for formatter, create another parameterized constructor and pass all the required dependencies through this constructor, declare all the dependencies as private read-only variables.

  5. Class name must same as job “Formatter” in “<<AssistEdge>>\app\Vanguard\Monitor\PeriodicXml\MonitorAlerts.xml” file.

  6. IAlertFormatter interface contains a method ‘Format” as displayed.
    Details of the Format method:
    This method returns a list of the alerts for which notification is sent.
    1. Input parameter (string infoFilePath) – This is the file path which contains details like “From”, “To List”, “Subject” etc. These files are present at the location “<<AssistEdge>>\app\Vanguard\Monitor\Formatter\NotifyContent\”. Create your own file which must be readable by the formatter of the notification type.
    2. Input parameter (string alertDetail) – This is the content of the alert. For OOB alert, A JSON string is returned.
    3. Input parameter (string alertName) – This is the name of the triggered alert.
    4. Output parameter (List<SendItem>) - List of alerts to be sent.
  7. Copy the Notfiycontent file to the path “<<AssistEdge>>\app\Vanguard\Monitor\Formatter\NotifyContent\’.
  8. Open the “<<AssistEdge>>\app\Vanguard\Monitor\PeriodicXml\MonitorAlerts.xml” file and update the formatter of the alert.
  9. Build the DLL in Release, AnyCPU mode. Place the DLL at “<<AssistEdge>>\app\Vanguard\” location.

Updating OOB Email Template

Follow the below steps to update the OOB email template:

  • Open and update the file “<<AssistEdge>>\app\Vanguard\Monitor\Formatter\Template\AE_Email_Template.html’. “_CONTENT_TO_REPLACE_” must be present in the template. This text is replaced with the message body during runtime.

Adding new CRON Alert

To add a custom alert, follow the below mentioned steps:

  1. For adding a CRON job first BackgroundJob Create API should be called which does the respective entry in Product database. For detail refer product api docs. Then respective .NET core dll should be created.
  2. Create a class library in .NET 6.0 version.
  3. Add a reference to below dlls. They are available at the location “<<AssistEdge>>\app\Vanguard\”.
    1. Quartz.dll
    2. Quartz.Serialization.Json.dll
    3. EV.AE.Vanguard.Cron.Core.dll
    4. EV.AE.Utilities.Logging.Core.dll
  4. Implement the abstract class CronJobBase from EV.AE.Vanguard.Cron.Core.dll. Pass all the required dependencies of the job through constructor, declare all the dependencies as private read-only variables and extend CronJobBase base class constructor with logging dependency.

  5. Ensure to ExecuteJob returns Task.CompletedTask and should not return null.


     

    NOTE: 

    • Make sure CRON expression should be valid.
    • Product recommends a Job that should have a higher interval for execution.  A job running at lower interval like seconds may rise issues with Product other bankground jobs execution.

  6. Build the DLL in Release, AnyCPU mode. Place the DLL at “<<AssistEdge>>\app\Vanguard\” location.
  7. Take backup of EV.AE.Vanguard.Core.deps.json.
  8. Update EV.AE.Vanguard.Core.deps.json with entries required for the new custom dll and its dependencies dlls. You can refer EV.AE.Vanguard.Cron.Core.dll entry present in EV.AE.Vanguard.Core.deps.json file.
    Entries should be done in section
    1. targets -> .NETCoreApp,Version=v6.0 -> EV.AE.Vanguard.Core/1.0.0 -> dependencies
    2. targets -> .NETCoreApp,Version=v6.0
    3. libraries