[jBPM] - ProcessEventListener methods executed twice
by Sebastien Lelarge
Sebastien Lelarge [http://community.jboss.org/people/slelarge] created the discussion
"ProcessEventListener methods executed twice"
To view the discussion, visit: http://community.jboss.org/message/632356#632356
--------------------------------------------------------------
Hi,
I am playing with ProcessEventListener implementation and I have the feeling that methods are executed twice for the same Node.
For now, I am just tracing a message when a method is triggered and I get it twice in the log file !
My goal is to fire rules when I reach a Rule Task Node because I have issues if I fireAllRules at process startup...
What's wrong ?
Here's how I initialize the ksession
{code}
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(base, kconfig,
JPAWorkingMemoryDbLogger wkfLogger = new JPAWorkingMemoryDbLogger(ksession);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new CommandBasedWSHumanTaskHandler(ksession));
ksession.addEventListener(new JbpmProcessEventListener(ksession));
{code}
here's the code of my EventListener:
{code}
import org.drools.event.process.ProcessCompletedEvent;
import org.drools.event.process.ProcessEventListener;
import org.drools.event.process.ProcessNodeLeftEvent;
import org.drools.event.process.ProcessNodeTriggeredEvent;
import org.drools.event.process.ProcessStartedEvent;
import org.drools.event.process.ProcessVariableChangedEvent;
import org.drools.runtime.StatefulKnowledgeSession;
import org.jbpm.workflow.core.node.RuleSetNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JbpmProcessEventListener implements ProcessEventListener {
private StatefulKnowledgeSession session;
private static Logger logger = LoggerFactory.getLogger(JbpmProcessEventListener.class);
public JbpmProcessEventListener(StatefulKnowledgeSession ksession){
session = ksession;
}
public void beforeVariableChanged(ProcessVariableChangedEvent event) {
}
public void beforeProcessStarted(ProcessStartedEvent event) {
}
public void beforeProcessCompleted(ProcessCompletedEvent event) {
}
public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
logger.debug("beforeNodeTriggered: " + event.getNodeInstance().getNode().getClass());
logger.debug("beforeNodeTriggered: " + event.getNodeInstance().getNode().getName());
if (event.getNodeInstance().getNode() instanceof RuleSetNode) {
session.fireAllRules();
}
}
public void beforeNodeLeft(ProcessNodeLeftEvent event) {
}
public void afterVariableChanged(ProcessVariableChangedEvent event) {
}
public void afterProcessStarted(ProcessStartedEvent event) {
}
public void afterProcessCompleted(ProcessCompletedEvent event) {
}
public void afterNodeTriggered(ProcessNodeTriggeredEvent event) {
}
public void afterNodeLeft(ProcessNodeLeftEvent event) {
}
}
{code}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/632356#632356]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 6 months
[jBPM] - the db schema creation explaination
by wiwengweng wen
wiwengweng wen [http://community.jboss.org/people/wiwengweng] created the discussion
"the db schema creation explaination"
To view the discussion, visit: http://community.jboss.org/message/632189#632189
--------------------------------------------------------------
this is how I debug the codes, and find out something I don't understand so far.
I use mysql db, when codes go into "createGroup", one record is created in the jbpm_id_group table. can someone tell me how the commandService work? what is the "execute" function mean?? :)
hope to learn and heard from you~
Vincent
appended codes:
identityService.createGroup("management");
public String createGroup(String groupName) {
return commandService.execute(new CreateGroupCmd(groupName, null, null));
}
public interface CommandService {
String NAME_TX_REQUIRED_COMMAND_SERVICE = "txRequiredCommandService";
String NAME_NEW_TX_REQUIRED_COMMAND_SERVICE = "newTxRequiredCommandService";
/**
* @throws JbpmException if command throws an exception.
*/
<T> T execute(Command<T> command);
}
public class CreateGroupCmd implements Command<String> {
private static final long serialVersionUID = 1L;
protected String groupName;
protected String groupType;
protected String parentGroupId;
public CreateGroupCmd(String groupName, String groupType, String parentGroupId) {
this.groupName = groupName;
this.groupType = groupType;
this.parentGroupId = parentGroupId;
}
public String execute(Environment environment) throws Exception {
IdentitySession identitySession = environment.get(IdentitySession.class);
return identitySession.createGroup(groupName, groupType, parentGroupId);
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/632189#632189]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 6 months
[JBoss Messaging] - Re: JBoss JMS standalone GUI tool for beginners showing queues and messages
by Gaurav Das
Gaurav Das [http://community.jboss.org/people/user_gaurav] created the discussion
"Re: JBoss JMS standalone GUI tool for beginners showing queues and messages"
To view the discussion, visit: http://community.jboss.org/message/632174#632174
--------------------------------------------------------------
This is the full stack trace
No Queues are displayed
10/18 09:25 ICIT JMS Monitor 0.1 starting ...
10/18 09:25 Log file opened: C:\DOCUME~1\gaurav.das\LOCALS~1\Temp\icitmon0.log
10/18 09:25 Running on x86 Windows XP 5.1 with Sun Microsystems Inc. Java HotSpot(TM) Client VM 1.6.0-b105
10/18 09:25 Labels loaded from: resources/config/mariotoolslabels.txt
10/18 09:25 Reading settings from file C:\DOCUME~1\gaurav.das\LOCALS~1\Temp\ICITMonSettings0.1.xml
10/18 09:25 JavaSystemOut: 09:25:25,739 INFO : tools.ConfUtil - Log4j configured from: resources/config\log4j.properties
10/18 09:25 JavaSystemOut: 09:25:25,739 INFO : tools.ConfUtil - Properties loaded from: resources/config\jndi.properties
10/18 09:25 Starting connect window
10/18 09:25 JavaSystemOut: 09:25:25,786 INFO : tools.ConfUtil - Properties loaded from: resources/config\jndi.properties
10/18 09:25 Added window ICIT JMS Monitor 0.1 Connect to JBoss server
10/18 09:25 ERROR:
JavaSystemError - Exception in thread "Timer-1" java.lang.IndexOutOfBoundsException: Invalid index
at javax.swing.DefaultRowSorter.convertRowIndexToView(Unknown Source)
at javax.swing.JTable.convertRowIndexToView(Unknown Source)
at javax.swing.JTable.repaintSortedRows(Unknown Source)
at javax.swing.JTable.sortedTableChanged(Unknown Source)
at javax.swing.JTable.tableChanged(Unknown Source)
at javax.swing.table.AbstractTableModel.fireTableChanged(Unknown Source)
at javax.swing.table.AbstractTableModel.fireTableRowsUpdated(Unknown Source)
at nl.intercommit.mario.tools.jbossmon.ServerQueueMon.updateData(ServerQueueMon.java:347)
at nl.intercommit.mario.tools.jbossmon.ServerQueueMon$qInfoUpdateTask.run(ServerQueueMon.java:24)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Regards,
Gaurav
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/632174#632174]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 6 months