As we have discussed certain repositories, we will now use them to deploy processes. To start with the deployment, we will take an example of the Attune University where a customer registers for a training. So, in this process, the customer will provide their name, e-mail ID, date, and the topic for which they want training. Once they submit their request, it will be sent to the BDE, who will check whether or not the trainer is available on the specified date. Then, he will schedule the training with the trainer and a mail will be sent to both the trainer and trainee regarding the training schedule. The process will look as shown in the following screenshot:
AttuneUniversity-Process
in Eclipse by navigating to File | New | Other | Activiti Project:trainingRequest
. We can do that by navigating to File | New | Other | Activiti Diagram.Start
node into the canvas and populate the Properties Form tab to accept values from the user as in the following screenshot:gonzo
so that he can perform the task and execute the process:Mail
task, as shown in the following screenshot; the mail will be sent to the trainee and will contain trainingTopic
with the name of the trainer, trainerName,
and the date of training, trainingDate
:customerName
, trainingDate
, and trainingTopic
:ExecuteProcess
having a main method configuring standalone process engine with database, as in the following code: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(); // Deploying The process into the repository repositoryService.createDeployment().addInputStream( "trainingRequest.bpmn20.xml", ReflectUtil .getResourceAsStream("diagrams/trainingRequest.bpmn")) .deploy();
createDeployment
method will create the deployment file for us. As we have a .bpmn
file, we need to generate a .bpmn20.xml
file for the deployment.