[jBPM] - Using Timers to Interrupt Synchronous Process in jBPM5
by dme
dme [http://community.jboss.org/people/dme] created the discussion
"Using Timers to Interrupt Synchronous Process in jBPM5"
To view the discussion, visit: http://community.jboss.org/message/633745#633745
--------------------------------------------------------------
Hi,
How can I use an event timer to interrupt a synchronous process in jBPM5? I have created a process which has a subprocess that performs a task (say MyCustomTask). I have a boundary event timer set to 500ms. I observe the following behaviour:
1. If in MyCustomTask if I do not call "completeWorkItem", the event timer fires correctly after 500ms
2. If in MyCustomTask if I make a call to "completeWorkItem" as the only thing the task does, the event timer does not fire which is as expected, as the sub-process has completed before the timer got a chance to fire
3. If in MyCustomTask if I sleep for 1sec (1000ms) and then make call "completeWorkItem", the event timer does not fire. How can I get the timer to fire in this case?
It seems that the timer is using the same thread as the MyCustomTask and for synchronous task it will not fire? How can I make the timer to fire when if a sub-process does not complete within "x" seconds?
Attached is the process file and Java (Handler and Driver) code for my test.
Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/633745#633745]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months
[jBPM] - I have same problems when i user Human Task on MYSQL
by losfa jon
losfa jon [http://community.jboss.org/people/sd1527907] created the discussion
"I have same problems when i user Human Task on MYSQL"
To view the discussion, visit: http://community.jboss.org/message/634008#634008
--------------------------------------------------------------
hi
first i start my Server and add a new user (customer);
and it works ok
but when i use Client to start a process
it throws a sql error
that is
Hibernate: select user_.id from OrganizationalEntity user_ where user_.id=?
Hibernate: insert into Task (allowedToDelegate, taskInitiator_id, priority, activationTime, actualOwner_id, createdBy_id, createdOn, documentAccessType, documentContentId, documentType, expirationTime, faultAccessType, faultContentId, faultName, faultType, outputAccessType, outputContentId, outputType, parentId, previousStatus, processInstanceId, skipable, status, workItemId) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Content (content) values (?)
Hibernate: update Task set allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processInstanceId=?, skipable=?, status=?, workItemId=? where id=?
Hibernate: insert into PeopleAssignments_BAs (task_id, entity_id) values (?, ?)
28-10-11 afternoon 04:01 org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 1452, SQLState: 23000
28-10-11 afternoon 04:01 org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Cannot add or update a child row: a foreign key constraint fails (`jbpm5`.`peopleassignments_bas`, CONSTRAINT `FK9D8CF4EC2C122ED2` FOREIGN KEY (`entity_id`) REFERENCES `organizationalentity` (`id`))
it happen becouse of the Table Task is null
but on the log sql
Hibernate: insert into Task (allowedToDelegate, taskInitiator_id, priority, activationTime, actualOwner_id, createdBy_id, createdOn, documentAccessType, documentContentId, documentType, expirationTime, faultAccessType, faultContentId, faultName, faultType, outputAccessType, outputContentId, outputType, parentId, previousStatus, processInstanceId, skipable, status, workItemId) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
the task has insert into values
so i don.t know how to do it
if someone who know please help me
thanks
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/634008#634008]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months
[jBPM] - Re: Change a Timer length/period at runtime possible?
by Ryan Peterson
Ryan Peterson [http://community.jboss.org/people/rrpeterson] created the discussion
"Re: Change a Timer length/period at runtime possible?"
To view the discussion, visit: http://community.jboss.org/message/634065#634065
--------------------------------------------------------------
After getting some help from krisv (thanks again btw!) I think I'm closer, but still not quite able to get this to work.
I've tried canceling the old timer (canceling portion works great), but setting up the new timer seems to give issues.
The route I'm trying is:
((TimerNodeInstance) nodeInstance).cancel();
// create timerInstance
TimerInstance timerInstance = new TimerInstance();
timerInstance.setDelay(TimeUtils.parseTimeString("5s")); // hard-code to X seconds
timerInstance.setPeriod(0); // hard-code to a period of 0
then I register the new timerInstance with the processInstance:
((InternalProcessRuntime)((WorkflowProcessInstance) nodeInstanceContainer).getKnowledgeRuntime().getProcessRuntime()).getTimerManager().registerTimer(timerInstance, (org.jbpm.process.instance.ProcessInstance) nodeInstanceContainer);
Lastly I set the timerInstanceId into the TimerNodeInstance:
((TimerNodeInstance) nodeInstance).internalSetTimerId(timerInstance.getId());
My trouble is the new timer event never fires. The old one is definitely canceled, if I set it for a short value (like 5 seconds) it doesn't fire after cancellation. But it's like the new timer is missing something, as it never fires either no matter what delay value is set.
I've also tried modifying the IntervalTrigger time of the original timer, but this change doesn't seem to get picked up either.
Both of these I've done while the processInstance.disconnect() was called, and processInstance.reconnect() is called afterwards.
Thanks for any help/suggestions!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/634065#634065]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months