Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Built-in scheduler to delete old emails and attachments #18

Closed
alexbudarov opened this issue Feb 3, 2021 · 1 comment
Closed

Built-in scheduler to delete old emails and attachments #18

alexbudarov opened this issue Feb 3, 2021 · 1 comment
Assignees
Milestone

Comments

@alexbudarov
Copy link

Motivation:
https://www.cuba-platform.ru/discuss/t/otklyuchenie-sledov-zhiznedeyatelnosti-u-cuba-emailer/5396

Customer is complaining about growing size of the database.
95% of the database is consumed by emails and their attachments.

I think we need to have built-in cleaning scheduler out-of-the-box.
Scheduler should hard-delete messages, attachments from DB and associated files from file storage.

Settings:

  • max age of messages
  • some settings to distinguish unimportant messages to be deleted from important business letters that should be stored much longer or forever.

Addressing the problem of different kinds of messages
E.g. a system can send:

  • booking confirmations and notifications - that aren't too important and can be deleted after some time
  • salary documents, invoices - that are important and must be kept for many years or forever

In the simplest implementation we can define two kinds of messages: important or non-important.
Cleaning scheduler has two settings: max age of important messags (or forever), and max age of non-important messages.

Important / nonimportant, or "category" - this attribute can be set via a single Boolean / String attribute, or via set of tags.
Such attribute would be also convenient for categorizing / grouping messages in the browser of sent emails.

@Desire456
Copy link
Contributor

Implementation

EmailCleaner hard-delete old email messages, their attachments from DB, and associated files from file storage by settings, which contains in the application.properties file:

  • jmix.email.useDefaultEmailCleaningQuartzConfiguration - true if default Email Cleaning quartz scheduling configuration is used. By default that property is false and EmailCleaner is not working.
  • jmix.email.emailCleaningCron - CRON expression that is used by default Email Cleaning quartz scheduling configuration.
  • jmix.email.maxAgeOfImportantMessages - the maximum age (in days) of important messages after which they must be deleted. Zero value (0) means that messages won't be removed.
  • jmix.email.maxAgeOfNonImportantMessages - the maximum age (in days) of messages after which they must be deleted. Zero value (0) means that messages won't be removed.
  • jmix.email.cleanFileStorage - true if deleted from file storage is performed while the cleaning scheduler is working.

Desire456 added a commit to jmix-projects/jmix-translations that referenced this issue Aug 12, 2021
@lovtsovaik lovtsovaik assigned imorenov94 and unassigned lovtsovaik Aug 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants