[jboss-user] [JBoss jBPM] - Re: HowTo: Use JBPM4 API (on JBoss 5)

JimDwyer do-not-reply at jboss.com
Thu Jul 30 07:01:05 EDT 2009


You need to built a little java class with a method like this:  

public void startWorkflow(){
		try{
			InitialContext ctx = new InitialContext();
			ProcessEngine processEngine = (ProcessEngine)ctx.lookup("java:/ProcessEngine");
			
			// ProcessEngine and Services are to be used as singletons.  (ie they are threadsafe)
		    RepositoryService repositoryService = processEngine.getRepositoryService();
		    ExecutionService executionService = processEngine.getExecutionService();
		    TaskService taskService = processEngine.getTaskService();
		    HistoryService historyService = processEngine.getHistoryService();
		    ManagementService managementService = processEngine.getManagementService();
		    
		   
		    ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncActivity");
			System.out.println("ProcessId: " + processInstance.getId());
			
		}catch (NamingException ne){
			System.out.println(ne);
		}



Then call that from a jsp or something.  

     <%jsp useBean id="bean" class="org.someco.Test" scope="session" />
     <% bean.startWorkflow(); %>

Package the class and jsp into a war, deploy the war on the jboss.  

That should do it.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4246949#4246949

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4246949



More information about the jboss-user mailing list