Document retention

Functionality

The documents stored in the file area can automatically be removed by activating the document retention function. As documents are permanently deleted from the file area it is very important to have a backup scheme in place for recovery and rollback.

Activating

The function can be activated by setting the configuration parameter "documentRetention.enabled" to true and restarting the application.

Note that if the file area contains many documents the initial time for a full clean up can take some time. Activation is best done outside office hours and the file area and log files should be monitored for any problems.

Scheduling

The clean up job is executed every minute (53sec) and checks for expired documents according to the configuration parameters. At the most 100 documents are deleted every cycle.

Retention age policy

The document age policy can be configured for two types of document states.

Configuration parameters:
"inactiveDocumentAge": All documents that are in an intermediate state or the corresponding order is in state Rejected, Canceled or Expired.
"completedDocumentAge": All documents for orders that are in state Accepted/Completed.

Recovery and rollback

In the case of file area, database corruption or change in retention age policy to retrieve old documents, the documents can be rolled back by the following procedure:

  1. Stop the application
  2. Restore the files from backup to the file area.
  3. Optionally change or disable document retention while investigating root causes.
  4. Run SQL command: UPDATE documents SET file_state = 0
  5. Start the application

When the periodic schedule is activated again the documents will be deleted according to (new) settings.