# SetChangeDataRetentionBarrier

The method can be used to:

* Set a retention barrier for deleting consumed partitions. Setting a retention barrier will initiate periodic deletion of consumed Change Data Partitions from the target database defined for the specified task. Partitions will be deleted according to the Allow consuming applications to delete partitions every interval set on Replicate Server, and up to the specified "retention\_point".
* Remove the retention barrier, thereby stopping periodic deletion of consumed Change Data Partitions.

Information note

* Partitions will only be deleted if the Change Data Partitioning and Partition Retention options are enabled in the Replicate console.
* Partitions will only be deleted if the task is running. If the task is not running, the partitions will be deleted the next time it runs.
* Only partitions that are not locked by a consuming application will be deleted.

Required User Role: See [Required Enterprise Manager permissions](https://help.qlik.com/en-US/enterprise-manager/May2026/Content/EnterpriseManager/EnterpriseManager_APIGuide/Introduction/AEMPermissions.htm).

## Syntax

`public void SetChangeDataRetentionBarrier(` ` AemSetChangeDataRetentionBarrierReq payload,  ` ` string server,  ` `string task` `);`

## Parameters

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| payload | AemSetChangeDataRetentionBarrierReq | Payload for Setting a Retention Barrier:<br><br>retention\_point=timestamp<br><br>application=application\_name<br><br>Where:<br><br><ul> <li><span>timestamp </span>is the date up to which partitions can be deleted. The timestamp must be in the following format: (yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'). </li> <li><span>application_name</span> is the name of the consuming application.</li> </ul><br><br>Example:<br><br>retention\_point=2020-06-30T16:15:00Z<br><br>application=Compose<br><br>Payload for Removing the Retention Barrier:<br><br>retention\_point=<br><br>application=application\_name<br><br>Where application\_name is the name of the consuming application. |
| server | string | The name of the server on which the task is running. |
| task | string | The name of the task. |

## Error response

Error responses

| Error | Message | Description |
| --- | --- | --- |
| AEM\_TASK\_NOT\_FOUND | Replication task {task] on server {server} could not be found. | Returned when an unknown task name is encountered. |
| AEM\_INVALID\_TIMESTAMP\_FORMAT | The specified partition retention barrier does not conform to the expected timestamp format. Timestamp format should be yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'. | Returned when the specified partition retention barrier does not conform to the expected timestamp format. |
| AEM\_SET\_CHANGE\_DATA\_RETENTION\_BARRIER\_INNER\_ERR | Failed to set change data retention barrier for task {task} on server {server}.<br><br>Message: {error\_message} | Returned when an error is encountered when trying to set the retention barrier. |