Jonathan Albornoz
2013-01-09 12:58:05 UTC
Jonathan Albornoz [https://community.jboss.org/people/betoflint] created the discussion
"Urgent, Mina Handler is not working"
To view the discussion, visit: https://community.jboss.org/message/789706#789706
--------------------------------------------------------------
Hi, i have configure my jbpm 53 with jboss 7.0.2 and the persistence is with oracle, all work fine in the console, but i have to make it work with the api.
I have the next code to start my proces and complete it! but when the task is complete, the handler not work, and dont reserve the next node.
I imagine that my handler is not used correctly. Any idea what is my problem in the code?? i use jbpm helper, that is configures in the jbpm-test in the runtime folder.
i dont know if mina is correctly used, neither if i must use hornetq, or anything else!!
I tried with jbpm 5.4 and i have the same problem...any please...this is very urgent!!
the files that i have is attached!! thanks!! please!!!
package com.sample;
import java.util.List;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.drools.KnowledgeBase;
import org.drools.SystemEventListenerFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import org.jbpm.process.workitem.wsht.HornetQHTWorkItemHandler;
import org.jbpm.task.TaskService;
import org.jbpm.task.query.TaskSummary;
import org.jbpm.task.service.SyncTaskServiceWrapper;
import org.jbpm.task.service.TaskClient;
import org.jbpm.task.service.hornetq.AsyncHornetQTaskClient;
import org.jbpm.task.service.mina.MinaTaskClientConnector;
import org.jbpm.task.service.mina.MinaTaskClientHandler;
import org.jbpm.task.service.mina.MinaTaskServer;
import org.jbpm.task.service.responsehandlers.BlockingTaskOperationResponseHandler;
import org.jbpm.task.service.responsehandlers.BlockingTaskSummaryResponseHandler;
import org.jbpm.test.JBPMHelper;
public class ProcessMain2 {
         public static final void main(String[] args) throws Exception {
                   startUp();
                   // load up the knowledge base
                   KnowledgeBase kbase = readKnowledgeBase();
                   StatefulKnowledgeSession ksession = JBPMHelper.newStatefulKnowledgeSession(kbase);
                   // start a new process instance
                   ksession.startProcess("com.sample.bpmn.hello");
                   //ksession.dispose();
                   System.out.println("Process started ...");
                   //Genero la conexion para acceder a las tareas usando TASK
                   TaskClient client = new TaskClient(new MinaTaskClientConnector("client 1",
                   new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
                   client.connect("127.0.0.1", 9123);
 //capturo las tareas reservadas
                   BlockingTaskSummaryResponseHandler taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
                   client.getTasksAssignedAsPotentialOwner("luis", "en-UK", taskSummaryResponseHandler);
                   List<TaskSummary> tasks = taskSummaryResponseHandler.getResults();
                   for (TaskSummary task: tasks) {
                             System.out.println(task.getId() + " " + task.getName() + " " + task.getStatus());
                   }
                   //para todas las tareas incluyendo las terminadas
                   taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
                   System.out.println("***************************************************");
                   client.getTasksOwned("luis", "en-UK", taskSummaryResponseHandler);
                   tasks = taskSummaryResponseHandler.getResults();
                   for (TaskSummary task: tasks) {
                             System.out.println(task.getId() + " " + task.getName() + " " + task.getStatus());
                   }
 //para iniciar una tarea
                   BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
                   client.start( 18, "luis", responseHandler );
                   responseHandler.waitTillDone(1000);
                   //para completar una tarea
                   responseHandler = new BlockingTaskOperationResponseHandler();
                   client.complete( 18, "luis", null , responseHandler);
                   responseHandler.waitTillDone(1000);
                   ksession.dispose();
                   System.exit(0);
         }
 private static KnowledgeBase readKnowledgeBase() throws Exception {
                   KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
                   kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);
                   return kbuilder.newKnowledgeBase();
         }
         private static void startUp() {
                   JBPMHelper.startH2Server();
                   JBPMHelper.setupDataSource();
 JBPMHelper.startTaskService();
         }
}
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/789706#789706]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
"Urgent, Mina Handler is not working"
To view the discussion, visit: https://community.jboss.org/message/789706#789706
--------------------------------------------------------------
Hi, i have configure my jbpm 53 with jboss 7.0.2 and the persistence is with oracle, all work fine in the console, but i have to make it work with the api.
I have the next code to start my proces and complete it! but when the task is complete, the handler not work, and dont reserve the next node.
I imagine that my handler is not used correctly. Any idea what is my problem in the code?? i use jbpm helper, that is configures in the jbpm-test in the runtime folder.
i dont know if mina is correctly used, neither if i must use hornetq, or anything else!!
I tried with jbpm 5.4 and i have the same problem...any please...this is very urgent!!
the files that i have is attached!! thanks!! please!!!
package com.sample;
import java.util.List;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.drools.KnowledgeBase;
import org.drools.SystemEventListenerFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import org.jbpm.process.workitem.wsht.HornetQHTWorkItemHandler;
import org.jbpm.task.TaskService;
import org.jbpm.task.query.TaskSummary;
import org.jbpm.task.service.SyncTaskServiceWrapper;
import org.jbpm.task.service.TaskClient;
import org.jbpm.task.service.hornetq.AsyncHornetQTaskClient;
import org.jbpm.task.service.mina.MinaTaskClientConnector;
import org.jbpm.task.service.mina.MinaTaskClientHandler;
import org.jbpm.task.service.mina.MinaTaskServer;
import org.jbpm.task.service.responsehandlers.BlockingTaskOperationResponseHandler;
import org.jbpm.task.service.responsehandlers.BlockingTaskSummaryResponseHandler;
import org.jbpm.test.JBPMHelper;
public class ProcessMain2 {
         public static final void main(String[] args) throws Exception {
                   startUp();
                   // load up the knowledge base
                   KnowledgeBase kbase = readKnowledgeBase();
                   StatefulKnowledgeSession ksession = JBPMHelper.newStatefulKnowledgeSession(kbase);
                   // start a new process instance
                   ksession.startProcess("com.sample.bpmn.hello");
                   //ksession.dispose();
                   System.out.println("Process started ...");
                   //Genero la conexion para acceder a las tareas usando TASK
                   TaskClient client = new TaskClient(new MinaTaskClientConnector("client 1",
                   new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
                   client.connect("127.0.0.1", 9123);
 //capturo las tareas reservadas
                   BlockingTaskSummaryResponseHandler taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
                   client.getTasksAssignedAsPotentialOwner("luis", "en-UK", taskSummaryResponseHandler);
                   List<TaskSummary> tasks = taskSummaryResponseHandler.getResults();
                   for (TaskSummary task: tasks) {
                             System.out.println(task.getId() + " " + task.getName() + " " + task.getStatus());
                   }
                   //para todas las tareas incluyendo las terminadas
                   taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
                   System.out.println("***************************************************");
                   client.getTasksOwned("luis", "en-UK", taskSummaryResponseHandler);
                   tasks = taskSummaryResponseHandler.getResults();
                   for (TaskSummary task: tasks) {
                             System.out.println(task.getId() + " " + task.getName() + " " + task.getStatus());
                   }
 //para iniciar una tarea
                   BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
                   client.start( 18, "luis", responseHandler );
                   responseHandler.waitTillDone(1000);
                   //para completar una tarea
                   responseHandler = new BlockingTaskOperationResponseHandler();
                   client.complete( 18, "luis", null , responseHandler);
                   responseHandler.waitTillDone(1000);
                   ksession.dispose();
                   System.exit(0);
         }
 private static KnowledgeBase readKnowledgeBase() throws Exception {
                   KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
                   kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);
                   return kbuilder.newKnowledgeBase();
         }
         private static void startUp() {
                   JBPMHelper.startH2Server();
                   JBPMHelper.setupDataSource();
 JBPMHelper.startTaskService();
         }
}
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/789706#789706]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]