Hi everyone,
I’m working on optimizing database cleanup in a Camunda 7 environment, since our database has grown quite large over time. Our processes are long-running (spanning years) and involve multiple subprocesses.
I want to use characteristics from the parent instance to dynamically determine the Time to Live (TTL) of each subprocess — without having to wait for the root process instance to finish.
Here’s the scenario:
- The root process represents a customer subscription.
- Each subprocess represents a periodic billing cycle.
- Depending on the subscription type, a variable frequency is defined:
- If frequency = monthly, the billing subprocess data should be kept for 3 months.
- If frequency = yearly, the billing subprocess data should be kept for 1 year.
I’m looking for the best way to implement this.
My initial idea was to, at the end of each billing subprocess, store its process instance ID and make an API call (via script) to update the TTL of those instances. But this approach doesn’t seem very efficient or elegant.
Is there any recommended way to set or adjust the TTL dynamically, based on process variables, for subprocesses that belong to a long-running parent instance?
Or any best practices for cleanup configuration in this type of use case?
Thanks in advance for any insights or suggestions!