In this example, when an event message arrives, a search for a substring in the event name is performed. If the string exists in the event name, then the return value is set to true. When creating a custom rule with this custom object, you can use any of the actions configured in the Platform to respond to the presence of this substring in the event name. This example uses Groovy scripting.
Name: ExampleEvent
Type: Event Rule
Description: Searches the name of an incoming event for a string. If the string is found, sets the return value to true.
Source Code:
String eventName = event.getName();
logger.debug("Event Name : " + event.getName() );
String subStringinEventName = (String)parameters.get("subStringinEventName");
if (subStringinEventName !=null)
{
if (eventName.contains(subStringinEventName))
{
return true;
}
}
return false;
Parameter:
Variable Name |
Display Name |
subStringinEventName |
Sub string in Event Name |