Customize ClockUtil

Hi folks,

as I understood, Camunda uses ClockUtil internally to retrieve current time. ClockUtil also allows me to set the current time, which could be a useful feature for simulating processes.

In our application, we have a similar, but more powerful mechanism, that e.g. also allows us to freeze the time.

Question: Is it somehow possible (by configuration) to inject my own implementation of a ClockUtil into Camunda?


Hi Stefan,

Don’t think so. The methods of ClockUtil are invoked statically everywhere and do not perform any kind of lookup of an implementation. Feel free to submit a pull request that improves this, if required.

Out of curiosity, what do you mean with:


We can mainpulate the time in our application and time travel into the future (or past), with a given offset. When done, time will move on from that point. We can reset to current time (and time will move on from current time). And we can freeze, i.e. all subsequent requests will get the same answer, until we resume the time.

Having a closer look at your ClockUtil, I think freeze is what you can do with setCurrentTime. I was looking for a way to adjust the time in the Camunda engine following the above mentioned time travel way so that timer events behave consistently with our application.

Maybe you have an idea to work around this or strong concerns about the idea, let me know in either case :wink:

If the requirement is important enough for our Customer, I might try to contribute something.

Thanks so far!


1 Like