What is the Relations between the tables where we are storing camunda meta data

Can someone help me to resolve the above issue please.

Regards,
Thanuja.

HI Ingo,

Can you please help me to resolve the above issue.

Regards,
Thanuja.

Hi @Thanuja_Vadlamudi,

I think you can’t set the removal time to a calculated value by batch.

What you can do is to query all processes started at a single day and set the removal time to a value calulaed by yourself (or your program).

If you loop over several days, the removal times should at least fit the expected day.

Hope this helps, Ingo

Hi Ingo,
Thank you so much for the explanation. I can proceed with this info.

And also I had created new process instance after deploying the below config changes. It is not setting the removal time once that process is completed. Can you please suggest me what step I missed to clear that process instance.

config.setBatchOperationHistoryTimeToLive(“P548D”);
config.setHistoryCleanupBatchWindowStartTime(“18:00”);
config.setHistoryCleanupBatchWindowEndTime(“22:00”); config.setHistoryCleanupStrategy(ProcessEngineConfiguration.HISTORY_CLEANUP_STRATEGY_REMOVAL_TIME_BASED);
config.setHistoryRemovalTimeStrategy(ProcessEngineConfiguration.HISTORY_REMOVAL_TIME_STRATEGY_END);
config.setHistoryCleanupBatchSize(100);

Regards,
Thanuja.

Hi Ingo,

Could you please answer the above question.

Regards,
Thanuja.

Hi @Thanuja_Vadlamudi,

the perfect setup to clean up old process instances from the history is:

  1. Add the history time to live in the BPMN model. All process instances starting with this model version will have a removal time once they are finished.
  2. Set the history time to live for older versions in the Cockpit (with Enterprise version, Cleanup View | docs.camunda.org) or with the Rest API. All new process instances started after the change from this version will have a removal time once they are finished.
  3. Handle process instances that are started before you setup the history time to live. Here the removal time has to be set via batch.

You can check with this REST call, how many process instances will be cleaned in the run: Get Cleanable Process Instance Report Count | docs.camunda.org

And with this REST Api you can check how many process instances have be cleaned up in a given interval. Use history-cleanup-removed-process-instances as the metrics name: Get Metrics in Interval | docs.camunda.org

Hope this helps, Ingo

1 Like

HI Ingo,

Much helpful.

  1. Set the history time to live for older versions in the Cockpit (with Enterprise version, Cleanup View | docs.camunda.org) or with the Rest API. All new process instances started after the change from this version will have a removal time once they are finished.
    we are using community version. we can achieve this with rest API that means query all processes started at a single day and set the removal time to a value calculated by yourself (or your program) right.

Basically 2nd point and 3rd point : set the removal time to a value calculated by yourself (or your program) right.

Regards,
Thanuja.

Hi @Ingo_Richtsmeier ,

Thank you for providing the above info . It worked after setting the TTL for existing process definitions. It is setting the removal time automatically once they are finished. Using the Rest API, I can able to set the removal time for completed process instances.

Can you also help me on setting the TTL for Batches , Job Logs , Metrics, Case Instances and Decision Instances. what is the time period we need to use for deleting these one’s.

  • Process Instances: Base time is either the time when the process instance starts or the time at which it finishes. This is configurable.

Configured as end + TTL(18 months) as per the business requirement.

  • Decision Instances: Base time is the time when the decision is evaluated.
  • Case Instances: The removal time concept is not implemented for case instances.
  • Batches: Base time is either the time when the batch is created or when the batch is completed. This is configurable.

Can you please suggest me what is the time period we need to configure to delete Decision Instances, case instances and Batches.

Appreciate your help in advance.

Regards,
Thanuja.

Hi @Thanuja_Vadlamudi,

here you can find the configuration parameters for all entities that can be cleaned up: History and Audit Event Log | docs.camunda.org.

Decisions and cases are handled in the same way as processes and my further comment here applies to them.

The time to live for job log, batches and metrics has to be filled in the engine configuration (i.e. application.yml in case of Spring Boot and Camunda Run).

Hope this help, Ingo

Hi Ingo,

There is no parameter historyCleanupJobLogTimeToLive in our config file. is there any similar property which cleanup history Cleanup Job Logs.

Regards,
Thanuja.

Hi Ingo,

Kindly help me here. the removal time of all instances is always equal to the removal time of the root instance. Kindly let me know how this can be achieved. In my case, I had set the TTL for root process Definition and child process Definition. Hence It is setting the removal time different than root instnace.

Kindly help me here.

Regards,
Thanuja.

Hi @Thanuja_Vadlamudi,

I didn’t get all the details from your question.

Could you please elaborate:

  • Which removal strategy did you configure?
  • How? Maybe you post the current configuration here.
  • Are any Removal_time_ values left blank in the database?

Cheers, Ingo

Hi Ingo,

Thanks for the Reply.

I had configured Removal-Time-based Strategy in the config file as below.

config.setHistoryTimeToLive(“P548D”);
config.setHistoryCleanupBatchWindowStartTime(“19:30”);
config.setHistoryCleanupBatchWindowEndTime(“22:30”);
config.setHistoryCleanupStrategy(ProcessEngineConfiguration.HISTORY_CLEANUP_STRATEGY_REMOVAL_TIME_BASED);
config.setHistoryRemovalTimeStrategy(ProcessEngineConfiguration.HISTORY_REMOVAL_TIME_STRATEGY_END);
config.setHistoryCleanupBatchSize(500);

using the below method, I had set the TTL for Root Process and Child process Definitions.
processEngine.getRepositoryService().updateProcessDefinitionHistoryTimeToLive(processDefinitionId, 5);

SeoSfdcBusinessOrder invokes SeoSfdcInitiatedAsriTransaction. SeoSfdcInitiatedAsriTransaction invokes SeoSfdcInitiatedAsriComponent.

SeoSfdcBusinessOrder:2:523028147
|
SeoSfdcInitiatedAsriTransaction:4:491490864
|
SeoSfdcInitiatedAsriComponent:2:367225788

It is setting Removal_time_ as Root process end time + TTL for the Root. Child - Child Process end time + TTL. It is setting differently for root and child. It should be consistent for root and its instances.

Regards,
Thanuja.

Regards,
Thanuja.

Hi Ingo,

Kindly help me in resolving the above issue.

Regards,
Thanuja.

Hi Ingo,

Root Process Instance ID is not set correctly for the process instances. For Example 154511894 - Root Process ID triggers 154512959 Process. 154512959 Process triggers 154513398 process.

154511894 → 154512959 → 154513398 .

In this case, 154512959 and 154513398 should have the root process instance 154511894 right? In our case It is setting the same process instance as root process instance.

Could you help me how it will set the root process instance. Below is the code to start the new process from another process.

camundaApi.startProcessInstanceByKey(Enums.Domain.swift, “SeoSfdcInitiatedAsriTransaction”, seoBusinessKey, variables);

processOperations.create(new ProcessInstanceRequest()
.domain(domain.toString())
.modelName(processDefinitionKey)
.businessKey(seoBusinessKey)
.variables(variables));

Regards,
Thanuja.

Hi @Thanuja_Vadlamudi,

if you start the process instance with an API call like you did, they are always independent process instances. They will always differ if the Root process instance ID.

The Root process instance ID is only available with Call activities.

To keep the connection of your processes, you may use the business key or a special process variable.

I’ve double checked the removal_time_ behavior with this example: https://github.com/camunda/camunda-bpm-examples/tree/master/spring-boot-starter/example-invoice. It behaves like documented here: History and Audit Event Log | docs.camunda.org.

The removal time of the subprocess is set only when the super process is ended. Both instances get the same removal time value.

Hope this helps, Ingo

Hi @Ingo_Richtsmeier ,

we used business key to connect those processes. Is there any way to cleanup the hierarchy at the same time for the independent processes.

Or should I change the the code to invoke the process using Call Activity ? In this case I need to update the root process instance id for all the existing process.

Kindly let me know which is flexible and recommended process.

Regards,
Thanuja.

Hi @Thanuja_Vadlamudi,

it depends on your use case if you should change your loosely coupled processes into thightly coupled processes with call activity, just to get the removal time set to the same dateTime.

It seems too technical to me as a good reason for changing the process design.

Is it really this important, that all processes get removed from the history at the same time?

Another option could be an end listener on the last process, that sets the removal time to a specific date.

This could be an example:

public class SetRemovalTimeListener implements ExecutionListener {

  @Override
  public void notify(DelegateExecution execution) throws Exception {
    Date removalTime = null;
    String historicProcessInstanceIds = null;
    execution.getProcessEngineServices()
     .getHistoryService().setRemovalTimeToHistoricProcessInstances()
     .absoluteRemovalTime(removalTime).byIds(historicProcessInstanceIds).executeAsync();
  }
}

Hope this helps, Ingo

1 Like

Hi Ingo,

I had created end listener on the last process as below.


Kindly correct me if it is not set correctly.

Regards,
Thanuja.

Hi @Thanuja_Vadlamudi,

looks good to me. Did you get the desired values in the database?

If yes, everything is fine.

If not, please provide the implementation of the Java class.

Hope this helps, Ingo