Purge History Camunda

Good night,

My high school teacher asked to create an application with Camunda + Spring + Rabbit, and use Oracle 12 as Database instead of H2 default. I managed with the help on the forum, build my application and consume the data from my RabbitMQ queue, however, my teacher requested to create a task to purge the Database data every 3 days. can you help me? How do I do that? Could you show me a snippet of code for me to implement?
I read the documentation:

But I do not quite understand, I’m sorry, I’m not a programmer.

This is my code:

This is my BPMN:
mybpmn.bpmn (6.2 KB)

Thank you =)

Seems like a strangely complicated task for a highschool teacher to give someone who isn’t a programmer. :man_shrugging: What kind of course is it?

I’ll hopefully be able to help you. there are a lot of ways of doing this depending on what data you want to remove.
You just need to give your process definition a history time to live and the engine will take care of the rest. by periodically running a clean up every day.

Alternatively if you want to get rid of more specific data every 3 days, you could start a process with a timer start event and then just use a service task to delete the data your want.

Hope that helps you find a solution.


Hi Nial,

Yes, in my country it is common to do the high school integrated with a technician, it is known as ETEC in Brazil. I’m in high school integrated with the computer technician. =)
The data that is in the Database, are the messages that I receive, that I keep them, and the historian of the right camunda? They are not important to me, so I want to clean everything up, as my teacher asked. You could show me a code example of the timer event process implementation and a process example of a time history to live on and the engine will take care of the rest. periodically performing a clean-up every day? I searched the github in the camunda-consulting repository, but I did not find something to base myself on the implementation.

Thank you =)

That ETEC sounds like a great idea. Hope it’s going well for you!

The timer itself doesn’t need any code to run - you just need to implement a timer start event with a cycle time of R/P3D and the engine will start the process itself every 3 days.

it would look something like this:

The service task could implement a Java Delegate which you could use to run a delete historic data via the Java API like this

1 Like

Hi Nial,

I read in


could I use the CRON expression in the Cycle field of my BPMN event right? In my case, to run every 3 days I could put 0 0 * / 3 * * correct? What is the difference between using CRON and the reported R / P3D value?
In my case, to clear the history of my MYPMN process I created a new process with the event timer and deploy it, as it does not need a startProcessInstanceBy to start as I understood the documentation, correct? Would that be the best way, or would it have a better way?

Thanks for your help =)

You can choose between CRON and the other notation. Either will work. I personally find CRON harder to read.

Indeed you don’t need to start the process. the engine will start it itself. Once more piece of advice i’d give is to set a History time to live:

This would mean the engine would clean up each finished instance 3 days after it has finished.


Hi Nial,

You helped me a lot.

Thank you =)

1 Like