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.
Seems like a strangely complicated task for a highschool teacher to give someone who isn’t a programmer. 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.
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.
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.
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?