开发者

jbpm process instance save

开发者 https://www.devze.com 2023-01-22 13:37 出处:网络
I am new to JBPM. I am using jbpm4.4 this is my basic example code: ProcessEngine processEngine = new Configuration()

I am new to JBPM. I am using jbpm4.4 this is my basic example code:

    ProcessEngine processEngine = new Configuration()
           .buildProcessEngine();
      NewDeployment deployment=processEngine.getRepositoryService().createDeployment().addResourceFromClasspath("com/pardis/jpdl/test.jpdl.xml");
      String deploymentId = deployment.deploy();
      Map<String,Object> variables = new HashMap<String,Object>();
      variables.put("customer", "John Doe");
      variables.put("type", "Accident");
      variables.put("amount", new Float(763.74));
      ProcessInstance processInstance = processEngine.getExecutionService().startProcessInstanceByKey("iran",variables,"doops");
processEngine.getExecutionService().signalExecutionById(processInstance.getId());

and this is my process definition:

<?xml version="1.0" encoding="UTF-8"?>

<process key="iran" name="test" xmlns="http://jbpm.org/4.4/jpdl">
   <start g="388,85,48,48" name="start1">
      <transition g="-49,-18" name="to state1" to="state1"/>
   </start>
   <end g="519,310,48,48" name="end1"/>
   <java class="test.TestAction" g="278,173,92,52" method="pr" name="java1">
      <arg> <object expr="#{type}"/> </arg>
      <arg> <object expr="#{customer}"/> </arg>
      <arg> <object expr="#{amount}"/> </arg>
      <transition name="to state2" to="state2" g="-49,-18"/>
   </java>
   <state g="89,151,92,52" name="state1">
      <transition g="-45,-18" name="to java1" to="java1"/>
   </state>
   <state name="state2" g="500,205,92,52">
      <transition name="to end1" to="end1" g="-42,-18"/&开发者_如何转开发gt;
   </state>
</process>

I have a question about it:

  1. suppose that the execution of the process is halted in some state, how could I persist the execution and resume it again? I want to run a process for multiple users and keep tracks of executions.

I think that JBPM documentation is very poor! so could you suggest a useful resource for me? thanks in advance


I must agree that the documentation for jbpm 4.x is slim. {I apologize in advance if the information isn't useful, still getting the hang of it myself}

It took me a while to get started. Edit : This blog was super helpful in getting started. As far as persistence goes it's not too rough to get started. You will need to specify a jbpm.hibernate.cgf.xml file.

If you have worked with hibernate before the config will be familiar. If not, this is a snippit from my test hibernate config file that connects to a MySQL DB :

<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/MySQL</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">password</property>
0

精彩评论

暂无评论...
验证码 换一张
取 消