[JBoss jBPM] - Problems with GraphSession.deleteProcessInstance()
by michaelholtzman
Greetings:
We need to periodically purge process instances that have ended before a certain data. There may be hundreds or thousands of instances that need to be cleaned up. The performance is very poor ... about 8 - 10 seconds PER INSTANCE.
Looking at the code (jBPM 3.1.2) I notice two things:
1 - task instances are not deleted (the delete query is not executed, which is just as well because the preceding query, findTaskInstanceIdsForProcessInstances, does not actually return a list of ids so it would fail anyway).:
| if (includeTasks) {
| query = session.getNamedQuery("GraphSession.findTaskInstanceIdsForProcessInstance");
| query.setEntity("processInstance", processInstance);
| List<?> taskInstanceIds = query.list();
|
| query = session.getNamedQuery("GraphSession.deleteTaskInstancesById");
| query.setParameterList("taskInstanceIds", taskInstanceIds);
| }
|
Fixing the findTaskInstanceIdsForProcessInstance query and inserting query.executeUpdate() results in constraint errors in the database.
2 - Deleting the process logs are done one log entry at a time
| // delete the logs for all the process instance's tokens
| if ( (tokens!=null)
| && (!tokens.isEmpty())
| ) {
| query = session.getNamedQuery("GraphSession.selectLogsForTokens");
| query.setParameterList("tokens", tokens);
| List<?> logs = query.list();
| iter = logs.iterator();
| while (iter.hasNext()) {
| session.delete(iter.next());
| }
| }
|
I'm guessing this is taking most of the execution time .... is there a way to batch delete these logs?
Thanx.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191854#4191854
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191854
17 years, 4 months
[JBoss jBPM] - sending emil in using JBPM
by shantanu.u
Apologies if these have been answered before. I'm really pulling my hair out trying to figure out how to send an email via JBPM.
I've read this file in the JBPM download :
jbpm-jpdl-3.2.2/doc/userguide/html/mail.html
My requirement is simple - send an email when a process transitions to another <task-node>
<task-node name="A" end-tasks="true">
<assignment pooled-actors="approver"/>
</task-node>
<task-node name="Manager" end-tasks="true">
--> I want to send an email here - when JBPM transitions process to this node.
<assignment pooled-actors="otherActor"/>
</task-node>
Here are the problems :
1. How do I achieve the above ? I gather there are 3-4 ways, but I would appreciate it if someone can tell me the correct way. I've only worked on JBPM for 3 days.
2. Where do I specify the mail server, user id, password - this is where I've hit the roadblock. I know the file is jbpm.cfg.xml. But what are the variable I need to specify. Or do I need to use mail-service.xml of JBOSS AS ?
The documentation is just not helpful.
Thanks very much.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191852#4191852
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191852
17 years, 4 months
[JBoss jBPM] - ExceptionHandler / changes since 3.2GA
by mpet
Hello,
I used a global exception handler in my process definition, like the following:
<?xml version="1.0" encoding="UTF-8"?>
| <process-definition
| xmlns="urn:jbpm.org:jpdl-3.2"
| name="simple">
| <start-state name="start">
| <transition name="to_state" to="first">
| <action name="action" class="com.sample.action.NoHandlerAvailable">
| <message>Going to the first state!</message>
| </action>
| </transition>
| </start-state>
| <state name="first">
| <transition to="end"></transition>
| </state>
| <end-state name="end"></end-state>
| <exception-handler>
| <action class="com.sample.action.TestExceptionHandler">
| </action>
| </exception-handler>
| </process-definition>
In the above example, the action handler com.sample.action.NoHandlerAvailable is not available (or maybe causes an exception). In case the exception handler class is not available (or causes an exception itself), 3.1.2 and 3.2GA stopped executing the process flow. After upgrading to 3.2.2 or above (have not tried 3.2.1), if the exception handler class is not available or causes an exception, that exception seems to be handled by the same exception handler - causing an (infinite ?) loop.
Might this be a bug or is the new behaviour intended? Or am I missing something?
Thanks for any help.
Marko
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191799#4191799
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191799
17 years, 4 months
[JBoss jBPM] - Re: variable scope from a script
by tbeernot
"kukeltje" wrote : btw, the 3.2 docs online are in more ways different from the 3.2.x docs. The 3.2.3 docs are also online but the links to it not always correct
Ok. In this case both the docs provided with the distribution as the online ones are in agreement. Plus, the method actually exists and also is executed without any exceptions thrown. So it seems the method really exists.
Although it does seem the code is somewhat complex without a good reason:
token.getProcessInstance().getContextInstance().setVariable("var","valueOfFork", token);
IMHO should be written as:
token.setVariable("var","valueOfFork");
But to reverse the question: how do people normally assign a value to a variable in the token scope form within a script? I assume more people do this.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191795#4191795
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191795
17 years, 4 months
[JBoss jBPM] - Re: jBPM 3.3.0GA and Oracle causing StaleObjectStateExceptio
by xnejp03
I'll re-open the JIRA, thanks. I tried to put back in the flush() into thetrunk code but getting this exception:
14:57:10,318 ERROR [GraphElement] action threw exception: collection [org.jbpm.bytes.ByteArray.byteBlocks] was not processed by flush()
| org.hibernate.AssertionFailure: collection [org.jbpm.bytes.ByteArray.byteBlocks] was not processed by flush()
| at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:205)
| at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:333)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| at org.jbpm.graph.node.Join.execute(Join.java:121)
| at org.jbpm.graph.def.Node.enter(Node.java:314)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
| at org.jbpm.graph.def.Node_$$_javassist_179.enter(Node_$$_javassist_179.java)
| at org.jbpm.graph.def.Transition.take(Transition.java:151)
| at org.jbpm.graph.def.Node.leave(Node.java:389)
| at org.jbpm.graph.exe.Token.signal(Token.java:192)
| at org.jbpm.graph.exe.Token.signal(Token.java:140)
| at uk.co.ondemand.portal.workflow.actions.AbstractNodeActionHandler.execute(AbstractNodeActionHandler.java:50)
| at org.jbpm.graph.def.Action.execute(Action.java:129)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)........
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191775#4191775
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191775
17 years, 4 months