How can I change the time unit?

cancel
Showing results for 
Search instead for 
Did you mean: 
siwara
Member II

How can I change the time unit?

Hi guys,

for simulation I need a customized time unit. How can I set my time unit in Activiti?

Best,

Siwara

7 Replies
ryandawson
Alfresco Employee

Re: How can I change the time unit?

Which Activiti version/product are you referring to? Could you give any examples of any particular places or features where you would want a different unit?

siwara
Member II

Re: How can I change the time unit?

I'm reffering to Activiti BPM in the current version. I'm trying to figure out whether Activiti BPM fits our needs.

We would like to use Activiti BPM for executing production processes. In advance a production process shall be simulated. For the simulation we would like to use a time unit that is decoupled from the real time.

So during the simulation, if a task needs to delay for 2 seconds we want to wait 2 simulated seconds not 2 real time seconds.

I guess we will need two process engine instances, one for the productive use and one for the simulation.

So, maybe there is a way to change the time unit for the process engine?

I didn't figure out if it's possible by reading the documentation and the java docs.

ryandawson
Alfresco Employee

Re: How can I change the time unit?

Let's take the task waiting situation then. What do you envisage will control the wait? It sounds to me most likely that you would have that logic in your implementation of the task and you'd just need to externalise configuration so that you can switch your timer unit (which I'm guessing means applying a multiplier to your defaults). Maybe you are thinking you would have Activiti timers in your processes too and if some of those are about time intervals then you'd need to externalise them. Activiti will let you can parameterise the timers and externalise any configuration (there is an example of a timer by expression at https://community.alfresco.com/thread/235516-how-to-set-a-time-cycle-for-specific-dates-each-month), though I think you'd need a redeploy or a bit of extra work if you want to change those intervals on the fly ( ). Is this the sort of thing you have in mind?

I was asking about version mostly because I couldn't tell if you were more interested in the process engine or a user interface. It sounds like the process engine is your focus.

siwara
Member II

Re: How can I change the time unit?

Thanks, Ryan!

What do mean with externalise? Sorry, I'm new to Activiti BPM and don't understand from what and where configurations shall be externalised.

But yes, the process engine is on my focus. 

ryandawson
Alfresco Employee

Re: How can I change the time unit?

By externalise I mean make available to change as a configuration parameter e.g. in a property file. I'm thinking it could be more a question of how an Activiti-based project is implemented using java.

siwara
Member II

Re: How can I change the time unit?

Dear Ryan,

thank you for your response. In fact I am implementing an Activiti based project in Java. My task is to create an as-fast-as possible simulation based Activiti. E.g. if the BPMN needs to wait for 2 seconds, I do not want it to wait 2 seconds in real time. Instead, I would like to advance the clock by 2 seconds without waiting 2 seconds in real-time.

jBPM offers the SessionPesudoClock class that enables advancing of the jBPM clock using the operation advanceTime(long amount, TimeUnit unit); Do you know if there is a similar mechanism in Activiti?

ryandawson
Alfresco Employee

Re: How can I change the time unit?

All the references to SessionPesudoClock that I can find seem to be to Drools-specific (i.e. for rules-management) rather than jBPM in particular. This makes some sense to me as I can see how that idea might be more important with rules-management and time-based rules than BPM. You could consider using Drools with Activiti if that's a feature you're particularly keen on and you're looking to use Activiti.

I am curious what you mean by 'BPMN needs to wait for 2 seconds'. Are you using Activiti User Guide  ? I ask because I am wondering if the time-based action could be controlled by a piece of code or configuration that you could set in a properties file. Then in the simulation version you could set a different value than you would set in the live version.