Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
devel:documentation:application_configuration:dev:scheduled_tasks:task-scheduler [2025/05/27 09:43] – koulaj | devel:documentation:application_configuration:dev:scheduled_tasks:task-scheduler [2025/06/04 08:43] (current) – koulaj | ||
---|---|---|---|
Line 4: | Line 4: | ||
The task can be scheduled in three different ways - types of '' | The task can be scheduled in three different ways - types of '' | ||
- | * Settled time - will enter a settled launching time If the time was entered in the past, then the task is launched right away. | + | |
+ | * Settled time - will enter a settled launching time If the time was entered in the past, then the task is launched right away. | ||
* Cron - [[http:// | * Cron - [[http:// | ||
* Dependent task - trigger task, when other task successfully ended. Dependent tasks are executed by [[..: | * Dependent task - trigger task, when other task successfully ended. Dependent tasks are executed by [[..: | ||
To run, schedule and review tasks, interfaces have been created: | To run, schedule and review tasks, interfaces have been created: | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | The descendants of these interfaces can be transmitted to the service '' | + | * '' |
+ | * '' | ||
+ | * '' | ||
+ | The descendants of these interfaces can be transmitted to the service '' | ||
- | To schedule the task, the [[http:// | + | To schedule the task, the [[http:// |
- | Every task has a defined instance (server) where it should be run. From one instance, it is possible to schedule tasks on more instances (one front-end for more back-ends over one database). The task running on the selected instance is ensured by the service '' | + | Every task has a defined instance (server) where it should be run. From one instance, it is possible to schedule tasks on more instances (one front-end for more back-ends over one database). The task running on the selected instance is ensured by the service '' |
When task type is removed (e.g. between module versions), then all scheduled task from this obsolete type are removed automatically - task type doesn' | When task type is removed (e.g. between module versions), then all scheduled task from this obsolete type are removed automatically - task type doesn' | ||
- | <note important> | + | <note important> |
- | When tasks has to run exclusively, | + | When tasks has to run exclusively, |
=== Cron in profile DEV === | === Cron in profile DEV === | ||
- | Tasks started by CRON in maven profile DEV was started only once for 3600000ms. This configuration is set by property: '' | + | Tasks started by CRON in maven profile DEV was started only once for 3600000ms. This configuration is set by property: '' |
=== Configuration QUARTZ (datasource, | === Configuration QUARTZ (datasource, | ||
- | Configuration of QUARTZ (scheduler) it is using application properties by individual profiles. In every profile application properties is necessary set path for quartz' | + | Configuration of QUARTZ (scheduler) it is using application properties by individual profiles. In every profile application properties is necessary set path for quartz' |
==== Example ==== | ==== Example ==== | ||
Line 44: | Line 44: | ||
The key concepts of stateful executors are queue and log. The queue is a set of records that have been processed, but the information about them is required for next run of the task. Take contract enable task as an example. Once a contract is valid, the task should process it. But it must be processed only once, not every time the task is run and the contract is valid. Therefore until the contract is valid, it is kept in the queue and will not be processed again. The log is a mechanism to keep track of what kind of items were processed by the task and what was the processing result. | The key concepts of stateful executors are queue and log. The queue is a set of records that have been processed, but the information about them is required for next run of the task. Take contract enable task as an example. Once a contract is valid, the task should process it. But it must be processed only once, not every time the task is run and the contract is valid. Therefore until the contract is valid, it is kept in the queue and will not be processed again. The log is a mechanism to keep track of what kind of items were processed by the task and what was the processing result. | ||
- | Stateful tasks are tightly coupled with Quartz' | + | Stateful tasks are tightly coupled with Quartz' |
- | All stateful tasks shall implement the '' | + | All stateful tasks shall implement the '' |
- | The item processing result is represented by '' | + | The item processing result is represented by '' |
- | **After the item processing finishes correctly (task is executed without exception or not canceled manually), the queue is refreshed. The algorithm is simple, as it only removes all items from queue, which were not processed correctly in current run. This mechanism ensures the removed items from queue will be processed in next task run, if will be given in '' | + | **After the item processing finishes correctly (task is executed without exception or not canceled manually), the queue is refreshed. The algorithm is simple, as it only removes all items from queue, which were not processed correctly in current run. This mechanism ensures the removed items from queue will be processed in next task run, if will be given in '' |
- | '' | + | '' |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
<note warning> | <note warning> | ||
Line 67: | Line 67: | ||
@since 10.2.0 | @since 10.2.0 | ||
- | Task can be executed repetitively without reschedule is needed. When task is canceled (e.g. by server is restarted), then task can be executed again (~recovered) directly from long running task agenda. New task will be created and executed with the same configuration as original task. **When task** is stateful and **supports queue**, then **already processed items will not be processed again**. | + | Task can be executed repetitively without reschedule is needed. When task is canceled (e.g. by server is restarted), then task can be executed again (~recovered) directly from long running task agenda. New task will be created and executed with the same configuration as original task. **When task** |
+ | < | ||
- | < | + | <note important> |
- | + | ||
- | <note important> | + | |
- | + | ||
- | {{ : | + | |
+ | {{ .: | ||
===== Implemented task types ===== | ===== Implemented task types ===== | ||
Line 86: | Line 83: | ||
Sends warning notification before password expires. Notification is **not send to disabled identities**. Days before has to be given as task's parameter (number greater than zero). More task could be configured e.g. for sending warning notification 14,7,3 days before password expires. Default notification topic is configured to email sender. | Sends warning notification before password expires. Notification is **not send to disabled identities**. Days before has to be given as task's parameter (number greater than zero). More task could be configured e.g. for sending warning notification 14,7,3 days before password expires. Default notification topic is configured to email sender. | ||
- | <note tip> | + | <note tip> |
==== PasswordExpiredTaskExecutor ==== | ==== PasswordExpiredTaskExecutor ==== | ||
+ | |||
Sends warning notification after password expires. Notification is **not send to disabled identities**. Default notification topic is configured to email sender. | Sends warning notification after password expires. Notification is **not send to disabled identities**. Default notification topic is configured to email sender. | ||
- | <note tip>Task is scheduled by default on the start of day: ** 0 5 0 ? * * ** - passwords which expired yesterday will be processed and proper notification will be send.</ | + | <note tip>Task is scheduled by default on the start of day: ** 0 5 0 ? * * ** - passwords which expired yesterday will be processed and proper notification will be send.</ |
==== AccountProtectionExpirationTaskExecutor ==== | ==== AccountProtectionExpirationTaskExecutor ==== | ||
- | Removes accounts with expired protection interval. Account has to have '' | + | |
+ | Removes accounts with expired protection interval. Account has to have '' | ||
==== RetryProvisioningTaskExecutor ==== | ==== RetryProvisioningTaskExecutor ==== | ||
- | Retry failed provisioning operation periodically. When provisioning operation fails, then is logged into provisioning queue with result (state, exception, result code etc.) and new attempt time. Number of attempts is **6** and time between attempts grows (2 mins, 5 mins, 20 mins, 2 hours, 12 hours - configuration coming soon). | + | Retry failed provisioning operation periodically. When provisioning operation fails, then is logged into provisioning queue with result (state, exception, result code etc.) and new attempt time. Number of attempts is **6** and time between attempts grows (2 mins, 5 mins, 20 mins, 2 hours, 12 hours - configuration coming soon). |
==== ExecuteScriptTaskExecutor ==== | ==== ExecuteScriptTaskExecutor ==== | ||
+ | |||
Long running task for execute script by code. Script can increment and initialize counter. | Long running task for execute script by code. Script can increment and initialize counter. | ||
==== ProvisioningQueueTaskExecutor ==== | ==== ProvisioningQueueTaskExecutor ==== | ||
- | Process provisioning operations in queue periodically. This LRT executes prepared (``created``) requests for provisioning, | + | |
+ | Process provisioning operations in queue periodically. This LRT executes prepared ('' | ||
=== Parameters === | === Parameters === | ||
- | * ``virtualSystem``, | ||
- | * ``true`` - processes ``created`` operations from queue for virtual system only, | ||
- | * ``false`` - processes ``created`` operations from queue for non virtual system only, | ||
- | * ``null`` - if ``virtualSystem`` parameters is not configured, then processes ``created`` operations from queue for all systems. | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
==== SynchronizationSchedulableTaskExecutor ==== | ==== SynchronizationSchedulableTaskExecutor ==== | ||
- | Schedule synchronization. | + | Schedule synchronization. |
=== Parameters === | === Parameters === | ||
- | * ``Synchronization uuid`` - synchronization configuration to schedule. | ||
- | ==== < | + | * '' |
+ | ==== | ||
+ | < | ||
- | @deprecated since 10.4.0 - '' | + | @deprecated since 10.4.0 - '' |
Long running task for add newly added automatic role to users. Can be executed repetitively to assign role to unprocessed identities, after process was stopped or interrupted (e.g. by server restart). | Long running task for add newly added automatic role to users. Can be executed repetitively to assign role to unprocessed identities, after process was stopped or interrupted (e.g. by server restart). | ||
=== Parameters === | === Parameters === | ||
- | * ``roleTreeNode`` - automatic role identifier. | ||
+ | * '' | ||
==== RemoveAutomaticRoleTaskExecutor ==== | ==== RemoveAutomaticRoleTaskExecutor ==== | ||
Line 133: | Line 135: | ||
=== Parameters === | === Parameters === | ||
- | * ``roleTreeNode`` - automatic role identifier. | ||
+ | * '' | ||
==== ProcessAutomaticRoleByTreeTaskExecutor ==== | ==== ProcessAutomaticRoleByTreeTaskExecutor ==== | ||
Line 142: | Line 144: | ||
=== Parameters === | === Parameters === | ||
- | * ``roletreenode`` - automatic roles by tree structure to recount. | ||
+ | * '' | ||
==== ProcessAllAutomaticRoleByTreeTaskExecutor ==== | ==== ProcessAllAutomaticRoleByTreeTaskExecutor ==== | ||
Line 166: | Line 168: | ||
@since 9.0.0 | @since 9.0.0 | ||
- | Long running task for add newly added role composition to users. Sub roles defined by this composition will be assigned to identities having superior role. Can be executed repetitively to assign unprocessed roles to identities, after process was stopped or interrupted (e.g. by server restart). | + | Long running task for add newly added role composition to users. Sub roles defined by this composition will be assigned to identities having superior role. Can be executed repetitively to assign unprocessed roles to identities, after process was stopped or interrupted (e.g. by server restart). |
=== Parameters === | === Parameters === | ||
- | * ``role-composition-id`` - role composition identifier. | ||
+ | * '' | ||
==== RemoveRoleCompositionTaskExecutor ==== | ==== RemoveRoleCompositionTaskExecutor ==== | ||
Line 178: | Line 180: | ||
=== Parameters === | === Parameters === | ||
- | * ``role-composition-id`` - role composition identifier. | ||
- | |||
+ | * '' | ||
==== IdentityContractExpirationTaskExecutor ==== | ==== IdentityContractExpirationTaskExecutor ==== | ||
- | Remove roles by expired identity contracts (=> removes assigned roles). | + | Remove roles by expired identity contracts (⇒ removes assigned roles). |
==== IdentityRoleExpirationTaskExecutor ==== | ==== IdentityRoleExpirationTaskExecutor ==== | ||
- | Long running task for expired identity roles removal. Expected usage is in cooperation with ``CronTaskTrigger``, running once a day after midnight. | + | Long running task for expired identity roles removal. Expected usage is in cooperation with '' |
==== IdentityRoleValidRequestTaskExecutor ==== | ==== IdentityRoleValidRequestTaskExecutor ==== | ||
Line 197: | Line 198: | ||
@since 7.5.1 | @since 7.5.1 | ||
- | HR process - enable identity' | + | HR process - enable identity' |
==== HrContractExclusionProcess ==== | ==== HrContractExclusionProcess ==== | ||
Line 210: | Line 211: | ||
HR process - end of identity' | HR process - end of identity' | ||
- | |||
==== SelectCurrentContractSliceTaskExecutor ==== | ==== SelectCurrentContractSliceTaskExecutor ==== | ||
Line 218: | Line 218: | ||
Recalculate current using slices as contract. Find all slices which should be for actual date using as contract and copy their values to parent contracts. | Recalculate current using slices as contract. Find all slices which should be for actual date using as contract and copy their values to parent contracts. | ||
- | ==== ChangeConfidentialStorageKey ==== | + | ==== ChangeConfidentialStorageKey ==== |
@since 8.2.0 | @since 8.2.0 | ||
- | Change key for crypt confidential storage. The task can be started after you change key in application properties/ | + | Change key for crypt confidential storage. The task can be started after you change key in application properties/ |
- | + | ==== GenerateConfidentialStorageInitializationVectorsTaskExecutor ==== | |
- | ==== GenerateConfidentialStorageInitializationVectorsTaskExecutor ==== | + | |
@since 10.8.0 | @since 10.8.0 | ||
- | The task processes every value in the confidential storage, generates a new initialization vector and encrypts the value using this new initialization vector. | + | The task processes every value in the confidential storage, generates a new initialization vector and encrypts the value using this new initialization vector. See the [[..:..:..: |
- | See the [[devel:documentation: | + | |
==== RemoveOldLogsTaskExecutor ==== | ==== RemoveOldLogsTaskExecutor ==== | ||
Line 238: | Line 235: | ||
=== Parameters === | === Parameters === | ||
- | * ``Number of days`` - removes logs older than given days count. | ||
+ | * '' | ||
==== DeleteProvisioningArchiveTaskExecutor ==== | ==== DeleteProvisioningArchiveTaskExecutor ==== | ||
Line 247: | Line 244: | ||
=== Parameters === | === Parameters === | ||
- | * ``Number of days`` - Delete operations older than given number of days. | ||
- | * ``Operation state`` - Delete operations in given state only. Available options [CREATED, RUNNING, EXECUTED, NOT_EXECUTED, | ||
- | * ``System`` - Delete operations with given system only. | ||
- | * ``Empty provisioning`` - Delete provisioning operations only without attributes. Operation with DELETE type is not considered as empty (even haven' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
<code sql> | <code sql> | ||
-- PostgreSql | -- PostgreSql | ||
Line 257: | Line 254: | ||
DELETE FROM sys_provisioning_archive WHERE created < now() - INTERVAL '90 day'; | DELETE FROM sys_provisioning_archive WHERE created < now() - INTERVAL '90 day'; | ||
-- Delete attributes | -- Delete attributes | ||
- | DELETE FROM sys_provisioning_attribute attr WHERE NOT EXISTS (SELECT FROM sys_provisioning_archive arch where attr.provisioning_id = arch.id) AND NOT EXISTS (SELECT FROM sys_provisioning_operation oper where attr.provisioning_id = oper.id); | + | DELETE FROM sys_provisioning_attribute attr WHERE NOT EXISTS (SELECT FROM sys_provisioning_archive arch WHERE attr.provisioning_id = arch.id) AND NOT EXISTS (SELECT FROM sys_provisioning_operation oper WHERE attr.provisioning_id = oper.id); |
</ | </ | ||
Line 267: | Line 265: | ||
=== Parameters === | === Parameters === | ||
- | * ``Number of days`` - Delete events older than given number of days. | ||
+ | * '' | ||
<code sql> | <code sql> | ||
-- PostgreSql | -- PostgreSql | ||
-- Delete events older then 3 days | -- Delete events older then 3 days | ||
- | delete from idm_entity_event | + | DELETE FROM idm_entity_event |
- | vacuum | + | vacuum |
</ | </ | ||
- | ==== DeleteLongRunningTaskExecutor==== | + | ==== DeleteLongRunningTaskExecutor ==== |
@since 9.7.12 | @since 9.7.12 | ||
Line 283: | Line 282: | ||
=== Parameters === | === Parameters === | ||
- | * ``Number of days`` - Delete long running tasks older than given number of days. | ||
- | * ``Operation state`` - Delete long running tasks in given state only. Available options [CREATED, RUNNING, EXECUTED, NOT_EXECUTED, | ||
+ | * '' | ||
+ | * '' | ||
<code sql> | <code sql> | ||
-- PostgreSql | -- PostgreSql | ||
-- Delete lrt by sql | -- Delete lrt by sql | ||
- | DELETE FROM idm_long_running_task WHERE created < now() - interval | + | DELETE FROM idm_long_running_task WHERE created < now() - INTERVAL |
-- Delete related processed items | -- Delete related processed items | ||
- | DELETE FROM idm_processed_task_item WHERE long_running_task IS NOT NULL and long_running_task NOT IN (SELECT id FROM idm_long_running_task); | + | DELETE FROM idm_processed_task_item WHERE long_running_task IS NOT NULL AND long_running_task NOT IN (SELECT id FROM idm_long_running_task); |
-- Clear lrt from related reports | -- Clear lrt from related reports | ||
UPDATE rpt_report SET long_running_task_id = NULL WHERE long_running_task_id IS NOT NULL AND long_running_task_id NOT IN (SELECT id FROM idm_long_running_task); | UPDATE rpt_report SET long_running_task_id = NULL WHERE long_running_task_id IS NOT NULL AND long_running_task_id NOT IN (SELECT id FROM idm_long_running_task); | ||
+ | |||
</ | </ | ||
- | <note tip>When long running task is deleted, then processed items are removed too. Scheduled task has another processed items - " | + | <note tip>When long running task is deleted, then processed items are removed too. Scheduled task has another processed items - " |
- | ==== DeleteNotificationTaskExecutor==== | + | ==== DeleteNotificationTaskExecutor ==== |
@since 9.7.12 | @since 9.7.12 | ||
Line 305: | Line 305: | ||
=== Parameters === | === Parameters === | ||
- | * ``Number of days`` - Delete notifications older than given number of days. | ||
- | * ``Sent only`` - Delete sent notifications only. All notifications older than given number of days will be deleted otherwise. | ||
+ | * '' | ||
+ | * '' | ||
<code sql> | <code sql> | ||
-- PostgreSql | -- PostgreSql | ||
-- Delete common notification | -- Delete common notification | ||
- | DELETE FROM idm_notification WHERE created < now() - interval | + | DELETE FROM idm_notification WHERE created < now() - INTERVAL |
-- Delete all related notification by type | -- Delete all related notification by type | ||
DELETE FROM idm_notification_console WHERE id NOT IN (SELECT id FROM idm_notification); | DELETE FROM idm_notification_console WHERE id NOT IN (SELECT id FROM idm_notification); | ||
Line 320: | Line 320: | ||
-- Delete recipients | -- Delete recipients | ||
DELETE FROM idm_notification_recipient WHERE notification_id NOT IN (SELECT id FROM idm_notification); | DELETE FROM idm_notification_recipient WHERE notification_id NOT IN (SELECT id FROM idm_notification); | ||
+ | |||
</ | </ | ||
Line 329: | Line 330: | ||
=== Parameters === | === Parameters === | ||
- | * ``Number of days`` - Delete synchronization logsolder than given number of days. | ||
- | * ``System`` - Delete logs on the given system only. | ||
+ | * '' | ||
+ | * '' | ||
<code sql> | <code sql> | ||
-- PostgreSql | -- PostgreSql | ||
Line 340: | Line 341: | ||
-- Delete items | -- Delete items | ||
DELETE FROM sys_sync_item_log WHERE sync_action_log_id NOT IN (SELECT id FROM sys_sync_action_log); | DELETE FROM sys_sync_item_log WHERE sync_action_log_id NOT IN (SELECT id FROM sys_sync_action_log); | ||
+ | |||
</ | </ | ||
- | ==== DeleteWorkflowHistoricInstanceTaskExecutor==== | + | ==== DeleteWorkflowHistoricInstanceTaskExecutor ==== |
@since 9.7.12 | @since 9.7.12 | ||
Line 349: | Line 351: | ||
=== Parameters === | === Parameters === | ||
- | * ``Number of days`` - Delete historic workflow processes older than given number of days. | ||
- | * ``Workflow definition`` - Delete historic workflow processes with this definition only. | ||
+ | * '' | ||
+ | * '' | ||
==== VsSystemGeneratorTaskExecutor ==== | ==== VsSystemGeneratorTaskExecutor ==== | ||
Line 359: | Line 361: | ||
=== Parameters === | === Parameters === | ||
- | * ``Item prefix`` - A name prefix of all generated entities. Serves for easier searching of entities in IdM. | ||
- | * ``System count`` - Number of generated virtual systems. | ||
- | * ``Role count`` - Number of generated roles. | ||
- | * ``User count`` - Number of generated identities. | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
==== AccountProvisioningTaskExecutor ==== | ==== AccountProvisioningTaskExecutor ==== | ||
- | @since 14.10.0 | + | @since |
This task allows provisioning of accounts only on selected systems, with the option to further restrict it to selected accounts only. | This task allows provisioning of accounts only on selected systems, with the option to further restrict it to selected accounts only. | ||
=== Parameters === | === Parameters === | ||
- | | + | |
- | * //Accounts// - Identifiers of accounts to be provisioned, | + | |
+ | * '' | ||
+ | === Alternatives and Discussion === | ||
+ | |||
+ | Use this task if you want to regularly align the state of accounts on selected systems. This is useful in cases where users make changes to accounts on the system, but IdM is the source of truth for these accounts and you want to enforce it regularly. | ||
+ | |||
+ | If you need a one-time state alignment, use the bulk action '' | ||
+ | |||
+ | On the other hand, if you need consistent and regular reconciliation, | ||
===== Testing tips ===== | ===== Testing tips ===== | ||
Line 379: | Line 389: | ||
===== Initializer ===== | ===== Initializer ===== | ||
- | Module core has default implementation of **AbstractScheduledTaskInitializer** - **InitCoreScheduledTask**. This class is responsible for initializing default scheduled task. See IdmCoreScheduledTasks.xml for xml structure. | + | |
+ | Module core has default implementation of **AbstractScheduledTaskInitializer** | ||
For another module is necessary implement subclass of AbstractScheduledTaskInitializer. | For another module is necessary implement subclass of AbstractScheduledTaskInitializer. | ||
Line 390: | Line 401: | ||
* Display of the scheduled triggers in the detail of the scheduled job. | * Display of the scheduled triggers in the detail of the scheduled job. | ||
* Recover canceled task by server is restarted automatically. | * Recover canceled task by server is restarted automatically. | ||
+ | |||
+ |