Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This Process flow contains the following activities:

  1. DataMapping - Mapping is This process will transform the event into an email to be dispatched as a notificationData Mapping and Query: The data mapping is utilized to query the backend database for a list of events that have been blocked for a duration exceeding the time specified in the process flow variable.

...

DataMapping ForEach Description:

Code Block
languagexml
$varExecuteQuery//Root/Record[(number(format-number(number(currentEpochTime ) - number( PREV_FIRE_TIME),'#')) > $varComparison and normalize-space(substring-after( TRIGGER_NAME,':' )) != '' and number(format-number(number(NEXT_FIRE_TIME ) - number( PREV_FIRE_TIME),'#')) < $varComparison) or (number(format-number(number(NEXT_FIRE_TIME ) - number( PREV_FIRE_TIME),'#')) > $varComparison and ((format-number(number(currentEpochTime ) - number( PREV_FIRE_TIME),'#') div format-number(number(NEXT_FIRE_TIME ) - number( PREV_FIRE_TIME),'#')) > (number($vargetMissFire) + 1)))]

...

  1. Gateway Condition: A gateway condition is implemented to verify if there is at least one event that satisfies the specified condition.

...

  1. Text Layout for Mail Notification: A structured text layout is utilized to encompass all necessary fields for the email notification. This layout is selected for its adaptability, facilitating the inclusion of additional fields as required in the future.

...

  1. Custom Plugin

...

  1. for XML to HTML Conversion: A custom plugin is employed to transform the XML stream into HTML format, enabling seamless integration with the mail notification system.

...

Custom code:

Code Block
languagejava
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.adeptia.indigo.services.ServiceException;
 
 
try 
	{    
          String hour = (String)context.get("hour");
		BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
		  StringBuffer sb = new StringBuffer();
	        sb.append("Hi,<br><br>This email is to notify you that some events have not been triggering for the past " + hour +" Hours.<br><br>The following events are currently stuck:<br><br>");
	        sb.append("<table \"width:70%\" border = \"1\">");
	        sb.append("<tr><th style=\"background-color:lightgrey;\">Event Name</th>"
	                        + "<th style=\"background-color:lightgrey;\">Last Fire Time</th>"+ "<th style=\"background-color:lightgrey;\">Action</th>");
	        sb.append("</tr>");

        String line = reader.readLine();
        while(line != null){
            String []str=line.split(",");
			if(str.length != 0){
            sb.append("<tr><td>");
            sb.append(str[0]);
            sb.append("</td><td>");
 
            sb.append(str[1] );
            sb.append("</td><td>");
			
			sb.append(str[2] );
            sb.append("</td><td>");

            sb.append("</tr>");
			}
            line = reader.readLine();
        }   
        sb.append("</table>");
       sb.append("<br>Thanks,<br>Adeptia Monitoring<br>");
	    // System.out.println(sb.toString());
            service.write(sb.toString().getBytes(), "default");
	}catch(Exception e) {  
			e.printStackTrace();
			throw new ServiceException(e);
	}
  1. Mail Target for Email

...

  1. Notification: A mail target is configured to dispatch the email notification to the intended recipient efficiently and reliably.

...

Conclusion

Following these steps will allow you to successfully deploy and configure the Adeptia process flow for sending email notifications for stuck events. For further assistance, please reach out to the Adeptia support team.

...