roxy1987 [https://community.jboss.org/people/roxy1987] created the discussion

"HornetQTaskHandler Issue"

To view the discussion, visit: https://community.jboss.org/message/797093#797093

--------------------------------------------------------------
*Hi,*
** 
*I picked the human task war file from jbpm-installer and deployed it in 
websphere server after making some changes to persistence.xml. The following is 
what the persistence.xml in the human task war looks like. Starting up 
websphere starts the human task service.*

 


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="1.0" 
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm 
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"; 
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://java.sun.com/xml/ns/persistence";>
  <persistence-unit name="org.jbpm.task">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>     
    <mapping-file>META-INF/Taskorm-JPA2.xml</mapping-file>
    
    <class>org.jbpm.task.Attachment</class>
    <class>org.jbpm.task.BooleanExpression</class>
    <class>org.jbpm.task.Comment</class>
    <class>org.jbpm.task.Content</class>
    <class>org.jbpm.task.Deadline</class>
    <class>org.jbpm.task.Delegation</class>
    <class>org.jbpm.task.EmailNotification</class>
    <class>org.jbpm.task.EmailNotificationHeader</class>
    <class>org.jbpm.task.Escalation</class>
    <class>org.jbpm.task.Group</class>
    <class>org.jbpm.task.I18NText</class>
    <class>org.jbpm.task.Notification</class>
    <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
    <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
    <class>org.jbpm.task.PeopleAssignments</class>
    <class>org.jbpm.task.Reassignment</class>
    <class>org.jbpm.task.Status</class>
    <class>org.jbpm.task.SubTasksStrategy</class>
    <class>org.jbpm.task.Task</class>
    <class>org.jbpm.task.TaskData</class>
    <class>org.jbpm.task.User</class>
    <properties>
                    <property name="hibernate.dialect" 
value="org.hibernate.dialect.DB2Dialect"/>
            <property name="hibernate.connection.driver_class" 
value="com.ibm.db2.jcc.DB2Driver"/>
            <property name="hibernate.connection.url" 
value="jdbc:db2://localhost:50000/jbpm5" />
            <property name="hibernate.connection.username" value="S28249"/>
            <property name="hibernate.connection.password" value="tyagiS"/>
      <property name="hibernate.dialect" 
value="org.hibernate.dialect.DB2Dialect"/>          
      <property name="hibernate.max_fetch_depth" value="3"/>
      <property name="hibernate.hbm2ddl.auto" value="update" />
      <property name="hibernate.show_sql" value="false" />  
      <property name="hibernate.transaction.manager_lookup_class" 
value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" />
      
      <!-- BZ 841786: AS7/EAP 6/Hib 4 uses new (sequence) generators which seem 
to cause problems -->      
      <property name="hibernate.id.new_generator_mappings" value="false" />
    </properties>
  </persistence-unit>
</persistence>

 



*Then I start the process like following :* 

****

*It starts a process but it doesnot assign the task to the user. It just 
creates a process instance and the first task remains in CREATED state. But it 
should be in RESERVED state.*
*COuld anyone help me here please.*
*Thanks.*
public void initiateProcess(String processName, String processDefId) throws 
Exception
 {
   StatefulKnowledgeSession ksession = 
BpmRepositoryConfig.createSession(processName);
  KnowledgeRuntimeLogger logger = 
KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "test", 1000);
  HornetQHTWorkItemHandler humanTaskHandler = new 
HornetQHTWorkItemHandler(ksession);
  humanTaskHandler.setIpAddress(ipAddress);
  humanTaskHandler.setPort(port);
  ksession.getWorkItemManager().registerWorkItemHandler("Human Task", 
humanTaskHandler);
  JPAWorkingMemoryDbLogger logger2 = new JPAWorkingMemoryDbLogger(ksession);
     ProcessInstance processInstance = ksession.startProcess(processDefId);
       long processInstanceId = processInstance.getId();
       System.out.println("Process Started : "+processInstanceId);
  logger.close();
  logger2.dispose();
 }
public static void readKnowledgeBase(String processName) throws Exception
 {
  try
  {
   if(kbase == null)
   {
    ProcessBuilderFactory.setProcessBuilderFactoryService(new 
ProcessBuilderFactoryServiceImpl());
    ProcessMarshallerFactory.setProcessMarshallerFactoryService(new 
ProcessMarshallerFactoryServiceImpl());
    ProcessRuntimeFactory.setProcessRuntimeFactoryService(new 
ProcessRuntimeFactoryServiceImpl());
    BPMN2ProcessFactory.setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    
    kbuilder.add(ResourceFactory.newClassPathResource(processName), 
ResourceType.BPMN2);
   }
  }
  catch(Exception e)
  {
   BpmExceptionHandler.handleException(e);
  }
 }
 
 
 public static StatefulKnowledgeSession createSession(String processName) 
throws Exception
 {
  KnowledgeSessionConfiguration config = null;
  readKnowledgeBase(processNames);
  EntityManagerFactory emf = Persistence.createEntityManagerFactory( 
"org.jbpm.persistence.jpa" );
  Environment env = KnowledgeBaseFactory.newEnvironment();
  try
  {  
   env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
   env.set( EnvironmentName.GLOBALS, new MapGlobalResolver() );  
   Properties properties = new Properties();
   properties.put("drools.processInstanceManagerFactory", 
"org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");
   properties.put("drools.processSignalManagerFactory", 
"org.jbpm.persistence.processinstance.JPASignalManagerFactory");
   config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
  }
  catch(Exception e)
  {
   BpmExceptionHandler.handleException(e);
  }
  return JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);
   
 }
 
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/797093#797093]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to