Notifications

Notifications are used to inform the API user about events from the DMS server. For each supported event, there is an Action property that can be set to an appropriate handler method. The method names for the handlers given in this document are, of course, just examples.

Note on Threading: The methods are called from any thread.

Note on offline Notifications: Starting with Documents.OnPremise Version 8.7.0, notifications can be persisted, and they reach the recipient through a persistent queue, ensuring that the recipient does not miss any subscribed events, even if the application is not running. If the API application is shut down or crashes, the missed events should be available once the application is running again. Only events that have been successfully processed are removed from persistence.

To persist notifications and make them available offline, a persistent queue must be created. The following LSB configurations must be made in the application to create the persistent queue:

public class LsbConfig : ILsbConfiguration  
{  
    public string RabbitMqHostname { get; set; } = "localhost";  
    public int    RabbitMqPort     { get; set; } = 5672;  
    public string RabbitMqUsername { get; set; } = "stpuser";  
    public string RabbitMqPassword { get; set; } = "stp.";  
    public string PersistentIdentifier { get; }  = "main";  
    public ushort PersistentPrefetchCount { get; } = 1;  
    public bool   UsePersistentQueue { get; } = true;  
}

UsePersistentQueue = true: A persistent queue is created. Notifications reach the application through this persistent queue. PersistentIdentifier: The name of the persistent queue. If no name is provided, the default name 'main' is set. PersistentPrefetchCount: Number of threads processing notifications. The default value is one. This is intended to ensure the processing order of notifications. For example, if a document is changed multiple times in a row, PersistentPrefetchCount = 1 should ensure that the order of notifications is maintained for the recipient. The downside of the value one is that processing notifications might take more time. If the order of notifications is not important to the application, a value greater than one can be entered in the config for better performance. However, PersistentPrefetchCount should not be greater than the number of CPUs.

If the caller (API) expects the persistent queue but the customer still has an older Documents.OnPremise version (older than 8.7.0), notifications work as before (everything works online), but offline events are lost.

Document Notifications

Document Imported

dms.Notifications.DocumentImported = DocumentImportedHandler;

This handler is always called when a new document is imported into LEXolution.DMS. The document data is received as an argument.

Document Deleted

dms.Notifications.DocumentDeleted = DocumentDeletedHandler;

This handler is always called when a document is deleted from LEXolution.DMS. The document data is received as an argument.

Document Data Changed, Content Changed

dms.Notifications.DocumentDataChanged = DocumentDataChangedHandler;
dms.Notifications.DocumentContentChanged = DocumentContentChangedHandler;

This handler is always called when a document is changed. It distinguishes between "index data" or "document content." The document data is received as an argument.

New Version Created for a Document

dms.Notifications.DocumentNewVersionCreated = DocumentNewVersionCreatedHandler;

This handler is always called when the content of a document is saved as a new version, or when completely different content is imported as a new version. The document data is provided as an argument.

File/Folder Notifications

The handling here does not differentiate between files and folders. Therefore, the notification names are generally: Container.

Container Created

dms.Notifications.ContainerCreated = ContainerCreatedHandler;

This handler is always called when a new file or folder is created in LEXolution.DMS. The container data is provided as an argument. Depending on the actual type, these need to be cast to DmsDossierData or DmsFolderData.

Container Data Changed

dms.Notifications.ContainerDataChanged = ContainerDataChangedHandler;

This handler is always called when the data of a file or folder is changed. The container data is provided as an argument. Depending on the actual type, these need to be cast to DmsDossierData or DmsFolderData.

Container Deleted

dms.Notifications.ContainerDeleted = ContainerDeletedHandler;

This handler is always called when a file or folder is deleted from LEXolution.DMS. The container data is provided as an argument. Depending on the actual type, these need to be cast to DmsDossierData or DmsFolderData.

Task Notifications

Currently, there is only a very general notification when tasks are created/changed/completed/etc. for any user/group.

Tasks Changed

dms.Notifications.TasksChanged = TasksChangedHandler;

This handler is always called when any active task is changed, or a new task is created. No data is provided. The API user must reload the list of active tasks for the current user. The notification only occurs if it affects the active user's task list.

Other Notifications

Access Rights Changed

dms.Notifications.AccessRightsChanged = AccessRightsChangedHandler;

This handler is always called when the access rights of any object change. The affected object IDs and the new access rights are provided as arguments. Objects can be documents, files, or folders.

Favorites Changed

dms.Notifications.FavoriteChanged = FavoriteChangedHandler;

This handler is always called when changes are made to the active user's favorites. The change made is provided as an argument.

Rendition Notifications

Rendition Created

dms.Notifications.NewRenditionCreated = NewRenditionCreatedHandler;

This handler is always called when a new rendition is imported into LEXolution.DMS. The rendition data is provided as an argument.

Rendition Changed

dms.Notifications.RenditionChanged = RenditionChangedHandler;

This handler is always called when the content of the rendition is changed. The rendition data is provided as an argument.

Rendition Deleted

dms.Notifications.RenditionDeleted = RenditionDeletedHandler;

This handler is always called when a rendition is deleted from LEXolution.DMS. The rendition data is provided as an argument.

This article has been automatically translated by an AI and may therefore contain errors.

Related to