When running the built in Ensemble Purge task (Ens.Util.Tasks.Purge) there are three parameters DaysToKeep, BodiesToo, and KeepIntegrity. This article focuses on the KeepIntegrity boolean parameter, but more information about running this task can be found here:
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...
KeepIntegrity determines which Ensemble Messages are marked for deletion within the time specified by DaysToKeep.