[JBoss jBPM] - Problem persisting tasks
by tangomannn
Hi, first of all I want to say that I checked the forum, but I didn't find anything to solve my doubt.
Intro:
I'm creating the process definition in a programmatic way. I create the ProcessDefinition, then the process Instances, and then I create the tasks dinamically. To create the tasks I have an event "node enter" and createTask = false in the NodeTask.
This is the ActionHandler I use to create the tasks: (I just put the important code)
| public void execute(ExecutionContext executionContext) throws Exception {
| JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
|
| TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();
| TaskNode nodeApproval = (TaskNode)executionContext.getNode();
| //get the only task definited in the processDefinition
| Task task = (Task)nodeApproval.getTasks().iterator().next();
| //taskNumber and user are variables
| //I instantiate for example 3 task
| for (int i=0; i<tasksNumber; i++){
| TaskInstance newTaskInstance= tmi.createTaskInstance(task, executionContext.getToken());
| newTaskInstance.setActorId(user);
| //THIS IS THE LINE that is not working
| jbpmContext.getSession().save(newTaskInstance);
|
| }
|
I have to put that line because if I don't put, the task instance does not save the actor. But the problem is that even if I instance three tasks it only saves one.
If I do this, with an xml (not programmatically) work well.
I had to use
jbpmContext.getSession().save(newTaskInstance);
and not jbpmContext.save( ..); because if I use this one on the close it gives me "object references an unsaved transient instance" exception
any idea, clue?
Thanks
Fernando
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199878#4199878
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199878
17 years, 3 months
[JBoss jBPM] - Unlock jobs, maxLockTime, fault tolerance
by jjrs
Hi,
I have been looking for references and some explanation about "maxLockTime" however the only post I have found is this one although I didn't find the answer to my questions there.
Is this parameter ever used ?
I haven't been able to find where the LockMonitorThread is started, therefore I believe it's never used, and the jobs in some situations are never unlocked.
The scenario that we have is:
* two different machines running one JobExecutor each (with several threads).
* the workflow definition is made up of async nodes and actions (parallel processing).
In case one instance (machine) stops working, the other one should pick up the work load of the other. After doing some tests I have seen that the job appears in the database lock by the JobExecutor and threads from one of the machines, and that job won't be unlocked (and therefore executed) by any JobExecutor thread running in the other machine. I thought that I could modify the code for starting the thread LockMonitorThread instead of just creating it, but if I try to start the thread I get a hibernate exception saying that the JobSession.findJobsWithOverdueLockTime query is missing, and the Jira ticket JBPM-1158 shows it as a pending issue.
I don't know if I am missing something or if it's just I don't understand the way maxLockTime, LockMonitorThread, etc... work.
I would appreciate any help.
Thanks.
Jose
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199844#4199844
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199844
17 years, 3 months
[JBoss jBPM] - Re: dual jbpm context
by tbeernot
"tbeernot" wrote : When trying to parse a ProcessDefinition from String using the static parseXmlString, underwater JbpmConfiguration.getInstance() is called.
|
The problem basically is with the static ProcessDefinition.createNewProcessDefinition; it accesses a static inner class Configs:
String resource = JbpmConfiguration.Configs.getString("resource.default.modules");
That will result in trying to get the factory, which will see if an instance is available via the depricated method:
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
Which ends up in JbpmConfiguration.jbpmConfigurationsStacks (a ThreadLocal variable).
If no instance is available, it will generate the default one, thus accessing jbpm.cfg.xml.
The approach would then have to be to push the active configuration on the thread local stack before each call and pop it afterwards.
This does not feel right.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199756#4199756
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199756
17 years, 3 months
[JBoss jBPM] - Re: dual jbpm context
by tbeernot
1. Having two JbpmConfigurations runs into some dead ends.
When trying to parse a ProcessDefinition from String using the static parseXmlString, underwater JbpmConfiguration.getInstance() is called.
JbpmConfiguration.getInstance(String) line: 278
JbpmConfiguration.getInstance() line: 257
JbpmConfiguration$Configs.getObjectFactory() line: 425
JbpmConfiguration$Configs.getObject(String) line: 437
JbpmConfiguration$Configs.getString(String) line: 441
ProcessDefinition.createNewProcessDefinition() line: 97
JpdlXmlReader.readProcessDefinition() line: 138
ProcessDefinition.parseXmlString(String) line: 150
Since I do not have a jbpm.cfg.xml anymore, it will revert to the embedded one. That is not the idea with having two separate configurations...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199748#4199748
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199748
17 years, 3 months