关于JBPM启动并自动执行的问题
有个问题请教大家,怎么让写好的JBPM流程启动后自动运行(因为我的流程中都是node,自动节点,中间不需要等待),我的理解的是用startprocessinstancecommand 启动一下就能执行,试了一下不行,加了个signalcommand,但执行完了数据库里(prcessinstance字段)显示实例已经运行完了,可是流程中的action都没执行是怎么回事啊 以下是试验代码
public class StartProcessTest { long id; private static JbpmConfiguration jbpmConfig = JbpmConfiguration .getInstance(); private static CommandService commandService = new CommandServiceImpl( jbpmConfig); public static void main(String[] args) { // TODO Auto-generated method stub StartProcessTest test = new StartProcessTest(); try { test.saveProcess(); } catch (Exception e) { e.printStackTrace(); } } public void saveProcess() throws Exception { JbpmConfiguration jbpmconfig=JbpmConfiguration.getInstance(); jbpmconfig.createSchema(); ProcessDefinition definition = ProcessDefinition .parseXmlResource("simple/processdefinition.xml"); definition.setName("first"); JbpmContext jbpmContext = jbpmConfig.createJbpmContext(); jbpmContext.deployProcessDefinition(definition); StartProcessInstanceCommand startCommand = new StartProcessInstanceCommand(); startCommand.setProcessName("first"); ProcessInstance pi = (ProcessInstance) commandService .execute(startCommand); if (pi != null) System.out.println("############OK##############"+"\n"+pi.getStart().toString());// // signal service 1 SignalCommand signalCommand = new SignalCommand(); signalCommand.setTokenId(pi.getRootToken().getId()); commandService.execute(signalCommand); jbpmContext.close();