Tasks Notifcations
Here’s a revised and organized version of the content for better readability and structure:
Background
Flux supports a comprehensive set of post-sync notifications and actions. These notifications include mechanisms like email alerts, REST API calls, script executions, and more, enabling teams or services to be informed of sync completions or errors and take further actions as required.
The notifications are configured under specific tags at the task level.
Notification Configuration Tags
1. NotificationsService Tag
Defines general properties related to failure notifications.
Property Name | Description | Default Value |
---|---|---|
failureNumberOfRetries | Number of failures before sending an alert. Set |
|
failureRetriesTime | Time (in milliseconds) from the first failure to the last, as per the retry count, before alerting. |
|
failureNotificationKeepSendTime | Time (in milliseconds) to wait after triggering an alert before sending another if the issue persists. |
|
2. Notifications Tag
Configures detailed properties for notification types and behavior.
Property Name | Description | Default Value |
---|---|---|
supportedTypes | Types of notifications supported (comma-separated). |
|
sendForEach | Whether to send individual alerts for each notification ( |
|
failureNotificationKeepSendTime | Time (in milliseconds) to wait after triggering an alert before sending another. |
|
sendInBackground | Sends the alert in the background if set to |
|
sendAtEnd | Sends alerts at the end of a task. Required if sendForEach is |
|
Note: When using notifications, ensure each SyncLogsDirectory
includes the parameter markCompletedTime
(time in milliseconds for considering a sync cycle as complete). For example, 10 seconds should be set as:markCompletedTime="10000"
Example Configuration
Below is an example of an XML configuration for handling multiple notifications in different scenarios (email, REST API calls, script execution, etc.).
<SyncLogsConfiguration>
<SyncLogsRepository repositoryDirectory="/mnt/FluxRepo" timeToKeep="30" />
<NotificationsService failureNumberOfRetries="2" failureRetriesTime="-1" failureNotificationKeepSendTime="100000">
<Notifications supportedTypes="FILE_COMPLETED" sendForEach="true" sendInBackground="false" sendAtEnd="false">
<Tasks>
<!-- Script Execution -->
<xpoTask exePath="cmd /c echo [NOTIFICATION_TIME] [FILE_NOTIFICATION_TYPE] > log.txt" name="Log Notification" />
<!-- Email Notification -->
<xpoTask MailAccountToId="ops@xplg.com" MailSubject="Flux Alert" classKey="xpolog.eye.automation.tasks.mail.MailTask" name="Email Notification" />
<!-- REST API Call -->
<xpoTask classKey="xpolog.eye.automation.tasks.restapi.RestApiTask" method="POST" url="https://flux-cluster/logeye/api/logger.jsp?token=xxx" name="API Notification">
<Param key="data" value="{"a":"b"}"/>
</xpoTask>
</Tasks>
</Notifications>
<Notifications supportedTypes="FILE_DELETE" sendForEach="false" sendInBackground="false" sendAtEnd="true">
<Tasks>
<xpoTask exePath="cmd /c echo Deletion Notification > deleted.log" name="Delete Notification" />
</Tasks>
</Notifications>
<Notifications supportedTypes="FILE_READ_FAILURE,FILE_WRITE_FAILURE,TASK_FAILED" sendForEach="true" sendInBackground="false" sendAtEnd="false">
<Tasks>
<xpoTask exePath="cmd /c echo Failure Notification > failures.log" name="Failure Notification" />
</Tasks>
</Notifications>
</NotificationsService>
<SyncLogsNode repositoryDirectory="data-server-1">
<Remote>
<Account classKey="xpolog.eye.media.remote.RemoteXplgAccount" name="data-server-1" />
</Remote>
<SyncLogsDirectory syncDirectory="/var/log/" markCompletedTime="10000" />
</SyncLogsNode>
</SyncLogsConfiguration>