Question
· Jul 28, 2021

will purge remove persistent class data

any persistan class can be used as msg body, if i use one of my persistent class(ex sample.person) as msg in the ensemble then perform purge  management where inculde msg bodies .. will we loose the sample.person data?
Product version: Caché 2016.1
$ZV: Cache for Windows (x86-64) 2016.1 (Build 656U) Fri Mar 11 2016 17:42:42 EST [HealthShare Modules:Core:14.02.2415 + Linkage Engine:14.02.2415 + Patient Index:14.02.2415 + Clinical Viewer:14.02.2415 + Active Analytics:14.02.2415]
Discussion (3)2
Log in or sign up to continue

Usually you do not mix between your "own" persistent (classes) data and Interoperability (aka Ensemble) request & respond messages (which are also persistent).

When you purge Ensemble data. the request/response messages are also being purged !

A best practice is to have for each component its own request/response messages. e.g.
PROD.BO.ComponentName.Msg.Request & PROD.BO.ComponentName.Msg.Response
where BO = business operation (so you could have BS for business service and BP for business process)
and ComponentName is the name of your components.
(sometimes few components, can share the same request & response messages, which is totally fine !)

In line with what @Yaron Munz was saying - when you purge your messages as part of your interoperability data, and you choose to include Message Bodies, then your Body class' data (whether your message body class extends from Ens.Request or Ens.Response, or whether it is simply a class extending from %Persistent) will get deleted together with the Message Header.

The purge code [in Ens.MessageHeader:Purge()] looks at the MessageBodyClassName and MessageBodyId fields of the MessageHeader record and then calls the %DeleteId() method for that class, for the given Id. 

That being said, as @Cristiano Silva pointed out if the class you use as your message body includes references to other persistent classes, these will not get deleted/purged with the referencing object, unless you have an %OnDelete callback method/Trigger taking care of this.

You can see these related posts I shared in the past -