So far, we have seen how to configure a process engine, deploy a process into the process engine, start a process, and query for a user task using an API.
Now, if there is a requirement to suspend a process, you can implement it using an API. We have already created a training process and now we want to suspend the process for some time. You can follow the ensuing steps to do so:
SuspensionActivation
class file to suspend the process with the following code in the class file:ProcessEngine processEngine = ProcessEngineConfiguration .createStandaloneProcessEngineConfiguration() .setJdbcDriver("com.mysql.jdbc.Driver") .setJdbcUrl("jdbc:mysql://localhost:3306/activiti_book") .setJdbcPassword("root").setJdbcUsername("root") .buildProcessEngine(); RepositoryService repositoryService = processEngine .getRepositoryService(); repositoryService.suspendProcessDefinitionByKey("traininngProcess");
SuspensionActivation
class file:ProcessEngine processEngine = ProcessEngineConfiguration .createStandaloneProcessEngineConfiguration() .setJdbcDriver("com.mysql.jdbc.Driver") .setJdbcUrl("jdbc:mysql://localhost:3306/activiti_book") .setJdbcPassword("root").setJdbcUsername("root") .buildProcessEngine(); RepositoryService repositoryService = processEngine .getRepositoryService(); repositoryService.activateProcessDefinitionByKey("traininngProcess");
Recently, we learned the use of the suspendProcessDefinition
and activateProcessDefinition
methods of repositoryService
. So, with their help, we can suspend and reactivate our processes.
ManagementService is used to maintain operations performed on the process engine. With the help of this service, we can upgrade the schema, fetch the executed commands and properties of the process engine, and execute the table page query for fetching table row data. ManagementService cannot be used in the workflow application. This service is just for managing your business process and not for executing any operations on the business process.
IdentityService is used for managing users and groups. We can create, update, delete, and update group and user information. Activiti doesn't perform checks on users at runtime, because in production you may have used a user management protocol such as LDAP. Using IdentityService, we can programmatically query for users and groups. We can delete a particular user or group. We can also create a new user and group.