cancel
Showing results for 
Search instead for 
Did you mean: 

Database - timer - diagram

ayseyo
Champ in-the-making
Champ in-the-making
Hi all,

I need to change timer duration without deploying the new diagram. I know I can change timer duration via bpmn diagram. But can I change it via only changing database. Where this data (PT10M for instance) is stored on database? I see only a 'Due Date' column on ACT_RU_JOB table.

While investigating this, another question had occured on my mind. Usually I managed activiti related issues on my project, and I deploy current bpmn diagram when a change is needed. but my colleagues don't have activiti-explorer on their computers so I share my activiti database to them. How can they manage to see bpmn diagrams then? Where and how bpmn diagrams are stored on database?

This is my first question here and I'm not sure 'Activiti Engine' is the right forum for my questions but it seemed it is to me.

Thanks..
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
1) Timer duration is not stored in the database in an individual column, instead, when the timer-job is created, the due-dateis calculated based on that value and inserted. The actual timer-definition (PT10M) is only stored as part of the whole process-definition in the XML. Changing the timer-definition for processes that are running with timers that are already scheduled (== have an entry in ACT_R_JOB) is not possible. If you alter the time-duration and redeploy the process-definition, all new instances will start with the new duration. If you which, you can alter the running process-instances as well, and force them to use the "new" definition instead of the old one. However, this is at your own risk. If you only alter the duration of a timer, this is quite safe. Take a look at org.activiti.engine.impl.cmd.SetProcessDefinitionVersionCmd and read the docs for this kind of solution.

If you have varying "timeouts", you should use expressions instead of fixed values for time-durations or calculate the actual dua-date using one of your services. You can use expressions to get hold of the duedate for a timer. This allows you to centralise all due-date calculations and make this work based on any algorithm you want (eg. store in database so you can change this while the engine is running). Take a look at the userguide to see how you can leverage expressions and existing services.

2) Depends on how the process is created. If you create the process in activiti designer or activiti modeler, the diagram will contains BPMN-DI information. This information exposes how a diagram should be rendered (coördinates and dimensions of all shapes). If such a procesdefinition is deployed in Activiti, a PNG-representation is created based on that. This is deployed along-side the process-definition and can be accessed through the API (repositoryService.getDeploymentResource(…)). It's also direclty available trough activiti-rest, which comes in handy when using remove systems:


GET repository/process-definitions/{processDefinitionId}

Will result in

{
  "id" : "oneTaskProcess:1:4",
  "url" : "http://localhost:8182/repository/process-definitions/oneTaskProcess%3A1%3A4",
  "version" : 1,
  "key" : "oneTaskProcess",
  "category" : "Examples",
  "suspended" : false,
  "name" : "The One Task Process",
  "description" : "This is a process for testing purposes",
  "deploymentId" : "2",
  "deploymentUrl" : "http://localhost:8081/repository/deployments/2",
  "graphicalNotationDefined" : true,
  "resource" : "http://localhost:8182/repository/deployments/2/resources/testProcess.xml",
  "diagramResource" : "http://localhost:8182/repository/deployments/2/resources/testProcess.png",
  "startFormDefined" : false
}

Which (if available) exposes a "diagramResource" property, pointing to the image (e.g.: "http://localhost:8182/repository/deployments/2/resources/testProcess.png").