Class AuthenticationEventPurgeJob

java.lang.Object
com.axelor.auth.events.job.AuthenticationEventPurgeJob
All Implemented Interfaces:
Job

@DisallowConcurrentExecution public class AuthenticationEventPurgeJob extends Object implements Job
Job to delete the AuthenticationEvent older than the retention period.

The retention period is defined in days by the "auth.events.retention" setting (defaults to 180). A value of zero or less keeps all events.

  • Field Details

    • DEFAULT_RETENTION_DAYS

      public static final int DEFAULT_RETENTION_DAYS
      Default number of days authentication events are kept.
      See Also:
  • Constructor Details

    • AuthenticationEventPurgeJob

      public AuthenticationEventPurgeJob()
  • Method Details

    • execute

      public void execute(JobExecutionContext context) throws JobExecutionException
      Specified by:
      execute in interface Job
      Throws:
      JobExecutionException
    • purgeExpiredEvents

      public long purgeExpiredEvents()
      Deletes the authentication events older than the retention period.
      Returns:
      the number of deleted events
    • purgeEventsBefore

      public long purgeEventsBefore(LocalDateTime date)
      Deletes the authentication events created before the given date.

      Events are deleted in batches, each in its own transaction, to avoid long-running transactions and locks on large tables.

      Parameters:
      date - the date before which events are deleted
      Returns:
      the number of deleted events