[jBPM Users] - Re: Hibernate, Sessions, and Sync - Oh my!
by MohReece
Michael, it looks like you're doing some custom asynchronous continuation, and the moment in which the new transaction is started (i.e. the jBPM context created) isn't related at all of the old transaction, which in a sense 'spawned' it - am I reading that correctly?
We have been doing something similar in our system (we're still using 3.1.4 for now, I guess you have a similar predicament in which upgrading an existing system just is easier said than done), and we encountered the same inconsistent and unpredictable SOSE occurrences.
The problem was that we used an indeterministic strategy for creating a new jBPM context in a new thread - we didn't wait for the old one to be closed and were 'hoping for the best' - unknowingly at first, of course.
We found a solution by making sure the new transaction is started only after the old one has ended: digging a little beyond the jBPM API into the Hibernate API, in which the org.hibernate.Transaction interface has the possibility to register a callback object (which must implement the javax.transaction.Synchronization interface). The latter object then is called before and after the two-phase-commit, and we used this last call as a starting point for the new transaction.
>From within an opened transaction we use something like this:
| jbpmContext.getSession().getTransaction().registerSynchronization(new Synchronization() {
| public void beforeCompletion() {
| // We're not using this one ourselves...
| }
|
| public void afterCompletion(int status) {
| // Here we spawn a new thread which can safely open its own jBPM context...
| }
| });
|
Hope this helps you out a little bit!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257185#4257185
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4257185
16 years, 7 months
[jBPM Users] - Showing the process diagram in my own application
by sebastian.s
Hello,
regarding the process diagram I've got a couple of questions. The reason is that I am looking for a way to display the process diagram as shown in the console in my own application.
As far as I know the process diagram is not generated at runtime but during the designing of the process using the GPD in Eclipse. And the image is packed into the .bar-file and deployed together with the process definition.
How does the console put the red arrow at the right place in the image? Is the g-attribute also parsed and stored in the database when a process is deployed? If yes is this information accessible via the API? If not how does the console deals with this?
| ..
|
| <task assignee="mike" g="352,169,92,52" name="escalated">
| <transition g="-50,-21" name="to task2" to="task2"/>
| </task>
|
| ..
|
Thanks in advance!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257173#4257173
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4257173
16 years, 7 months
[jBPM Users] - Re: Implementing Escalation in jBPM 4.1
by sebastian.s
I must be doing something wrong. I took the unit tests of the supplied examples as a base (regarding configuration files) which always worked fine for and I created my process and my tests. The problem is that an exception is thrown:
| 12:03:47,093 FIN | [ProcessDefinitionImpl] creating new execution for process 'escalation'
| 12:03:47,109 FIN | [DefaultIdGenerator] generated execution id escalation.1
| 12:03:47,234 FIN | [ExecuteActivity] executing activity(start1)
| 12:03:47,250 FIN | [DefaultIdGenerator] generated execution id escalation.1.timeout_task
| 12:03:47,406 FIN | [ExecutionImpl] created execution[escalation.1.timeout_task]
| 12:03:47,406 FIN | [ScopeInstanceImpl] creating timer on execution[escalation.1.timeout_task]
| ### EXCEPTION ###########################################
| 12:03:47,625 INF | [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd@694f12
| org.jbpm.api.JbpmException: no org.jbpm.pvm.internal.cal.BusinessCalendar in current environment
|
| <process name="escalation" xmlns="http://jbpm.org/4.0/jpdl">
| <start g="174,36,48,48" name="start1">
| <transition g="-106,-24" name="to timeout_task" to="timeout_task"/>
| </start>
| <task assignee="alex" g="152,168,92,52" name="timeout_task">
| <transition g="-50,-21" name="timeout" to="escalated">
| <timer duedate="5 seconds" />
| </transition>
| <transition g="-50,-21" name="to task2" to="task2"/>
| </task>
| <task assignee="mike" g="352,169,92,52" name="escalated">
| <transition g="-50,-21" name="to task2" to="task2"/>
| </task>
| <task assignee="peter" g="151,305,92,52" name="task2">
| <transition g="-48,-21" name="to end1" to="end1"/>
| </task>
| <end g="176,398,48,48" name="end1"/>
| </process>
|
| public void testTaskEscalaton() {
| ProcessInstance processInstance = executionService.startProcessInstanceByKey("escalation");
| String processInstanceId = processInstance.getId();
| processInstance = executionService.findProcessInstanceById(processInstanceId);
|
| List<Task> tasksAlex = taskService.findPersonalTasks("alex");
|
| if(tasksAlex.size() == 0) {
| fail();
| }
|
| Job job = managementService.createJobQuery()
| .timers()
| .processInstanceId(processInstance.getId())
| .uniqueResult();
|
| managementService.executeJob(job.getId());
| processInstance = executionService.findProcessInstanceById(processInstance.getId());
| assertTrue(processInstance.isActive("escalated"));
|
| List<Task> tasksMike = taskService.findPersonalTasks("mike");
| if(tasksMike.size() == 0) {
| fail();
| }
|
| tasksAlex = taskService.findPersonalTasks("alex");
| if(tasksAlex.size() == 1) {
| taskService.completeTask(tasksAlex.get(0).getId());
| } else {
| fail();
| }
|
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257169#4257169
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4257169
16 years, 7 months