JBoss Community

Signal Event is not happening in persisted process

created by ravichandrankg in jBPM - View the full discussion

Hi,

 

In our company, we are doing some sample process implementation for our application, to decide which BPM engine to be use. It mostly have external system communication, that will trigger the next set of activities in our application.

 

I am using the following sample process, with one human task and two script tasks with signal events (to trigger from external applications).

 

https://community.jboss.org/servlet/JiveServlet/downloadImage/2-751377-19130/450-88/Untitled.png

and first signal event is having the properties as below,

 

https://community.jboss.org/servlet/JiveServlet/downloadImage/2-751377-19132/310-138/properties.jpg

 

I am using JBPM 5.3.0.Final version, JBOSS 5.1 and MySQL 5.5.

 

I am creating a single knowledge session for whole my web application (singleton object holder class, initializing at server startup time). I am creating the process as,

 

 

     StatefulKnowledgeSession jbpmsession = util.getSession();

     UserTransaction ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );

     ut.begin();

     ProcessInstance instance = jbpmsession.startProcess("IngestMetadataAndFile", props);

     jbpmsession.insert(instance);

     ut.commit();

 

and the getSession method will return the new session for first time, and reloaded session there after, using the following code.

 

    

     StatefulKnowledgeSession sessionobj = null;

     Properties properties = new Properties();

     properties.put("drools.processInstanceManagerFactory", "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");

     properties.put("drools.processSignalManagerFactory", "org.jbpm.persistence.processinstance.JPASignalManagerFactory");

     KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);

 

     if (sessionId == -1) {

         sessionobj = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, config, env );

     } else {

                              try {

                                        sessionobj =  JPAKnowledgeService.loadStatefulKnowledgeSession( sessionId, kbase, config, env);

                              } catch(Exception e) {

                                        System.out.println("Exception in loading the session");

                                        sessionobj = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, config, env );

                              }

                    }

 

                    new JPAWorkingMemoryDbLogger(sessionobj);

                    KnowledgeRuntimeLoggerFactory.newConsoleLogger(sessionobj);

                    JPAProcessInstanceDbLog processLog = new JPAProcessInstanceDbLog(sessionobj.getEnvironment());

 

                    DsrClientHandler wsHumanTaskHandler = new DsrClientHandler(sessionobj);

                    wsHumanTaskHandler.setClient(client.getTaskClient());

                    sessionobj.getWorkItemManager().registerWorkItemHandler("Human Task",wsHumanTaskHandler);

        

With this code, i can able to create the process instance successfully and i am completing the human task by using HornetQ service. It is sucessfully completing the human task and coming to the script task (i can see the syslogs in the script task get printed). >From the script task, i am calling my business implementation java class and calling signal event after the business logic completion.

 

I am signalling as below,

 

       StatefulKnowledgeSession ksession =  util.getSession();

       ksession.signalEvent(eventtype, null, Long.parseLong(processid));

       //ksession.signalEvent(eventtype, null);

       ProcessInstance processinst = ksession.getProcessInstance(Long.parseLong(processid));

       //processinst.signalEvent(eventtype, null);

 

after this signalling, it is not coming to the next script task. I have developed my BPMN file by using eclipse (setup using JBPM 5.3 installer).

 

I dont know what is really wrong with my code. I am not getting any exception after the signal event, but console is printing the following logs.

 

 

 

2012-07-31 12:29:27,804 INFO  [STDOUT] (Thread-26) BEFORE PROCESS NODE EXITED node:External Task1[id=4] process:Sample new DSR Process[id=IngestMetadataAndFile]

2012-07-31 12:29:27,805 INFO  [STDOUT] (Thread-26) BEFORE PROCESS NODE TRIGGERED node:Signal[id=5] process:Sample new DSR Process[id=IngestMetadataAndFile]

2012-07-31 12:29:27,805 INFO  [STDOUT] (Thread-26) AFTER PROCESS NODE TRIGGERED node:Signal[id=5] process:Sample new DSR Process[id=IngestMetadataAndFile]

2012-07-31 12:29:27,805 INFO  [STDOUT] (Thread-26) AFTER PROCESS NODE TRIGGERED node:External Task1[id=4] process:Sample new DSR Process[id=IngestMetadataAndFile]

2012-07-31 12:29:27,805 INFO  [STDOUT] (Thread-26) AFTER PROCESS NODE TRIGGERED node:External Task1[id=4] process:Sample new DSR Process[id=IngestMetadataAndFile]

2012-07-31 12:29:27,805 INFO  [STDOUT] (Thread-26) AFTER PROCESS NODE TRIGGERED node:EnterMetadata[id=2] process:Sample new DSR Process[id=IngestMetadataAndFile]

 

 

can you please help me to get out of this issue, where i got stucked and invested lot of time :( .

 

 

Thanks,

Ravichandran

Reply to this message by going to Community

Start a new discussion in jBPM at Community