Events
A subscription is triggered by a Control Hub event. You can create a subscription for a single event type or for multiple event types.
A subscription is triggered each time the event occurs for objects that you have at least read permission on. For example, if you create a subscription for a changed job status, the subscription is triggered each time any job that you have permission on changes status. The subscription is not triggered for jobs that you do not have access to.
- Job Status Change
- Triggers the subscription each time a job status changes.
- Pipeline Committed
- Triggers the subscription each time a pipeline version is committed to the pipeline repository.
- Pipeline Status Change
- Triggers the subscription each time a pipeline status changes.
- Report Generated
- Triggers the subscription each time a data delivery report is generated.
- Data SLA Triggered
- Triggers the subscription each time a data SLA triggers an alert.
- Execution Engine Not Responding
- Triggers the subscription each time a registered Data Collector, Data Collector Edge (SDC Edge), or Transformer stops responding.
Filtering Events
By default, subscriptions are triggered when all events of the selected type occur. For example, an email is sent every time any job changes its status.
You can filter subscription events so that only a subset of events performs an action. For example, you can configure a subscription so that Control Hub sends an email only when the job named SocialMediaFeed changes status.
When filtering subscription events, the subscription is triggered for objects that you have at least read permission on and the filter condition. For example, if you create a subscription for all job statuses that change to inactive, the subscription first checks that you have permission on that job. If true, the subscription then checks the filter condition. If the filter condition is true, then the subscription triggers. The subscription is not triggered for jobs that you do not have access to.
To filter subscription events, define an expression using the StreamSets expression language.
Subscription expressions support a subset of elements provided with the StreamSets expression language, including:
- String and miscellaneous functions
-
All string functions are supported; however, typically you will use the following:
- str:contains()
- str:endsWith()
- str:startsWith()
For more information about the StreamSets expression language string functions, see string functions.
Some miscellaneous functions are also supported. For more information, see miscellaneous functions.
- Subscription parameters
- Use subscription
parameters to define the argument to evaluate. For
example:
${str:contains(REPORT_NAME, "tutorial"}
In this example, the expression evaluates to true when a report name contains the string tutorial.
Or, you can also use subscription parameters independent of the string functions. For example:${REPORT_NAME=="tutorial"}
In this example, the expression evaluates to true when the report name exactly matches the string tutorial.
Note the different syntax for using subscription parameters in event filtering as compared to subscription actions. You do not have to enclose the parameter name in double curly brackets in event filtering.
- Operators
-
You can use operators to create more complex expressions, such as
==
,>
, or&&
. All StreamSets expression language operators are supported.For more information about the StreamSets expression language operators, see operators.
Expression Completion
Use expression completion to determine the functions and parameters that you can use for each subscription filter.
To invoke expression completion, place the cursor in the filter where you want to create an expression and click Ctrl + Space Bar. Control Hub displays a list of valid expression elements which you can scroll through.
For example, when you invoke expression completion to filter a job status change event, the following list displays:
The list displays available parameters at the top with a red icon and displays available functions at the bottom with a green icon. Select a parameter or function from the list to add it to the filter.
${<expression>}
For more information on expression completion, see Tips for Expression Completion.
Example Expressions
Expression | Description |
---|---|
${str:contains(FROM_STATUS, "INACTIVE")} | Evaluates to true when the job status changes from inactive to any other status. |
${str:contains(TO_STATUS, "ACTIVE")} | Evaluates to true when the job status changes to active or inactive, but not activating or inactivating. |
${str:contains(ERROR_MESSAGE,"Not responding")} | Evaluates to true when the error message associated with the job status change contains the string Not responding. |
${TO_COLOR=="RED"} | Evaluates to true when the job status color changes to red. |
${str:startsWith(SLA_ID, “714ab”)} | Evaluates to true when the SLA ID starts with the string 714ab. |
${str:endsWith(REPORT_DEFINITION_ID, “775e”)} | Evaluates to true when the report definition ID ends with the string 775e. |
${PIPELINE_NAME=='test'} | Evaluates to true when the pipeline name is test. |
${JOB_NAME=='test1' || JOB_NAME=='test2'} | Evaluates to true when the job name is either test1 or test2. |
${JOB_NAME=='test' && str:contains(TO_STATUS, "INACTIVE")} | Evaluates to true when the job name is test and the job status changes to inactive. |
${LAST_REPORTED_TIME>1539734400} | Evaluates to true when the last reported time of an execution engine is earlier than the epoch or Unix time of 1539734400, or Tuesday, October 16, 2018 5:00:00 PM. |