[JBoss-user] [JBoss jBPM] - Automatic ProcessInstance presistancy when JbpmContext is cr
Hello all, I am trying to write a class to wrap up jBPM for my project development use. My program requires execution a huge number of small and short jbpm processes. By making some of these processes as non-presistant, it will keep jBPM database small. In this case, it will keep on switching between presistant process instances and non-presistant process instances. I am trying to create a JbpmContext using JbpmConfiguration.createJbpmContext() in constructor. I write like this coz I don't want to create a new JbpmContext everytime I execute Jbpm stuff, to save up some execution time. This method works fine until I need non-presistant Process Instance. Even if I use new ProcessInstance(processDefinition) instead of JbpmContext.newProcessInstance(processDefinition), it will still leave records into the database. By further looking into the codes, in Services.assignId(), it will call JbpmContext.getCurrentJbpmContext() and get a presistant service. as far as I understand from the codes, if I have created a JbpmContext, all of my process instances will be presisted into the database. Currently I will create a JbpmContext each time when I need presistant service, and close it immediately after use. This method works, but creation JbpmContext everytime I use may unnecessarily consume resources. May I know if there are any explicit ways to set a process instance to be presistant or non-presistant? Thanks. Philip View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3944111#3944111 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3944111 --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [JBoss jBPM] - Re: JBoss jBPM 3.1 Data Model Wiki
Thanks Kevin, your work really helps a lot. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3936744#3936744 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3936744 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [JBoss jBPM] - Removing obsolete ProcessDefinitions and ProcessInstances
Dear All, May I know if there are any ways to removed obsolete ProcessDefinitions (say newer versions have be deployed), and ProcessInstances which has finished? Thanks. Philip View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3932037#3932037 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3932037 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [JBoss jBPM] - Re: GraphSession.deleteProcessInstance taking over 10 minute
Dear Fallow, I am using jBPM 3.1. In file jbpm-starters-kit-3.1\jbpm\src\java.jbpm\org\jbpm\logging\db\DbLoggingService.java, function log(): | public void log(ProcessLog processLog) { | if (session!=null) { | session.save(processLog); | } | } | I have commented out session.save(processLog);. Somehow it will carry out all the logging processes, but it will not write anything to the database. In my case, it significantly improves the performance. I am not if the codes are similar in 3.0.1, I guess it is worthwhile to have a try. Hope it helps. Philip View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3929204#3929204 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3929204 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [JBoss jBPM] - Re: Getting started with sub workflows...
Hello Tim, I am a newbie stuggling with subprocesses too. Please have a look on the test code SubProcessPlusConcurrencyDbTest.java at jbpm-starters-kit-3.1\jbpm\src\java.jbpm.test\org\jbpm\graph\exe Not sure if it helps. That's what I am looking at to understand how it works. Philip View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3928673#3928673 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3928673 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [JBoss jBPM] - Re: Creating loops between nodes
Dear Elmo, I am trying the modify my code and run it, but I got a No row with the given identifier exists. Not sure why. BTW, I have tried the newProcessInstance() also. It runs but it suffers from performance and stack overflow issue. I guess we are not supposed to loop a ProcessInstance forever Thanks. Philip View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3927692#3927692 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3927692 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [JBoss jBPM] - Re: Creating loops between nodes
Hi Elmo, Ummm.. I am not very understand. You mean when ProcessInstance starts, in one of the nodes, it will create a separate thread, then the ProcessInstance will suspend, or return to main and save. When an event happens, this thread will load that ProcessInstance, and then continue its execution. Umm... I cannot figure out the looping mechanism. I guess above code implement the looping by not saving the ProcessInstance when it is invoked by the forked thread. Then next time when the forked thread loads the ProcessInstance again, it will load the ProcessInstance sits in the correct position. I don't know, I usually save the ProcessInstance immediately after I have used it. If I load the ProcessInstance from DB and let it run till the end, next time when I load and execute the same ProcessInstance again, it will said the ProcessInstance has already reached its end state. (Of course I can always move the token back to the start state by manipulating the token myself. But I guess it is always not preferred). I am reading async='true' now in chapter asynchronous continuations. I've tried adding the attribute into process definition, it doesn't work. I must have missed out something. Thanks. Philip View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3927376#3927376 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3927376 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [JBoss jBPM] - Re: Creating loops between nodes
Hi Elmo, Sorry I keeps on bothering you. Hopefully I didn't interfere your normal work. Ummm... It is a long story. In our project, we wish to use jBPM engine to process incoming events. We treat a ProcessInstance as the big boss. When the program starts, a ProcessInstance will be created, process something and reached a wait state. The most simpliest ProcessDefinition we have created is something like this. | Start --- Event Listener --- Process it --- End1 | ^---+ | The ProcessInstance will terminate when some conditions are fulfilled. Say it has received an END event. We do not exactly knows how many loops it will loop through. In above scenario, it will loop forever until the user issued the END event. The problem arise when using loop. If I draw the graph this way, allowing jBPM to handle the loop, it will break with StackOverFlow after a few hundred rounds. I tried to learn from jBPM source code, and I guess it is because the nodes are called recursively, causing function stack overflow. I tried to bypass this problem by saving the ProcessInstance into database (anyway, my project needs to save everything into the database to guard against system crashes). When it has finished one cycle, it suspends and flushes everything. Then when another event arrives, it loads back the ProcessInstance, puts the event into Context variable, and starts again. This method somehow works (of course the performance is horrible, we are not supposed to code like this), but the memory consumed will grow slowly, and the performance will gradually decline. About the connection, I am not sure. I have opened MySQL Administrator to have a quick check. It has 10 DB connections on average. Looks like Hibernate's connection pool has handled most of the problem. I don't know how to check the no. of connections in Hibernate. I will see if I can find it out. If the no. of Hibernate connections keep on increasing, then it can explain why the program gradually stall. Let me rework my code to see if it improves. Keep in touch. Thanks for your help. Philip View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3927339#3927339 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3927339 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [JBoss jBPM] - Re: Creating loops between nodes
Hello Elmo, Thanks for your pointer. I have checked out the site and look like Pattern 10 (Arbitrary Cycle) and Pattern 11 (Implicit Termination) suitable my needs. I am trying to work on Pattern 10 right now. When I mimic the pattern in Process Definition, it run. But when it has run for a while, it threw a stack overflow exception. It looks to me if the no. of nested function calls reaches a certain limit, it will overflow. I have tried to bypass it by suspending the Process Instance, save it into database, clean up existing Process Instance, load, resume and continue. I do this every round. At the beginning, the performance is OK. However, when it has processed some events, say 200 rounds, its performance steadily drops. No exception has been thrown however. I am not very sure how to improves it. Please help. Thanks. Philip View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3926460#3926460 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3926460 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [JBoss jBPM] - Re: Creating loops between nodes
Elmo, I am using MySQL 5.0.18. I am not sure if it is the cause of the problem. Please find attached the processdefinition I am using. I draw it using jBPM-Designer and then modify myself. ?xml version=1.0 encoding=UTF-8? | | process-definition | xmlns=urn:jbpm.org:jpdl-3.1 name=MultipleEvent |start-state name=start | event type=node-enter | action name=startAction class=com.multipleevent.action.StartHandler/action | /event | transition name= to=Location/transition |/start-state |state name=Location | event type=node-enter | action name=locationAction class=com.multipleevent.action.LocationHandler/action | /event | transition name=Location-Wait to=Wait/transition | transition name=Location-Wait2 to=Wait2/transition |/state |node name=Wait | event type=node-enter | action name=waitAction class=com.multipleevent.action.WaitHandler/action | /event | transition name= to=Process/transition |/node |state name=Process | event type=node-enter | action name=processAction class=com.multipleevent.action.ProcessHandler/action | /event |/state |node name=Wait2 | event type=node-enter | action name=waitAction2 class=com.multipleevent.action.WaitHandler/action | /event | transition name=Wait2-Process2 to=Process2/transition |/node |state name=Process2 | event type=node-enter | action name=processAction2 class=com.multipleevent.action.ProcessHandler/action | /event |/state | /process-definition | The main driver is the Location handler, I ask the handler to visit each branch by creating child tokens, then set the location back to Start, and suspend the process. public void execute(ExecutionContext executionContext) throws Exception { | Token token = executionContext.getProcessInstance().getRootToken(); | Token childToken = null; | ExecutionContext childExecutionContext = null; | | childToken = new Token(token, childToken); | childExecutionContext = new ExecutionContext(childToken); | childExecutionContext.getNode().leave(childExecutionContext,Location-Wait); | | childToken = new Token(token, childToken2); | childExecutionContext = new ExecutionContext(childToken); | childExecutionContext.getNode().leave(childExecutionContext,Location-Wait2); | | executionContext.getToken().setNode(executionContext.getProcessDefinition().getNode(start)); | executionContext.getProcessInstance().suspend(); | } In main, I write like this (The codes are very messy. I am sorry). public void run() { | JbpmConfiguration jbpmConfiguration = null; | ProcessDefinition processDefinition = null; | | JbpmContext jbpmContext = null; | ProcessInstance processInstance = null; | | try { | jbpmConfiguration = JbpmConfiguration.getInstance(); | processDefinition = ProcessDefinition.parseXmlResource(MultipleEvent.par/processdefinition.xml); | jbpmContext = jbpmConfiguration.createJbpmContext(); | jbpmContext.deployProcessDefinition(processDefinition); | processInstance = jbpmContext.newProcessInstance(MultipleEvent); | processInstance.signal(); | jbpmContext.save(processInstance); | } finally { | jbpmContext.close(); | } | | while (true) { | jbpmConfiguration = null; | processDefinition = null; | jbpmContext = null; | processInstance = null; | try { | jbpmConfiguration = JbpmConfiguration.getInstance(); | processDefinition = ProcessDefinition.parseXmlResource(MultipleEvent.par/processdefinition.xml); | jbpmContext = jbpmConfiguration.createJbpmContext(); | jbpmContext.deployProcessDefinition(processDefinition); | processInstance = jbpmContext.loadProcessInstanceForUpdate(process_id); | processInstance.resume(); | processInstance.signal(); | } | finally { | jbpmContext.close(); | } | } | } Other Action handlers are just print outs. When it was running, the JVM was growing
[JBoss-user] [JBoss jBPM] - Creating loops between nodes
I am using JBPM 3.1 + MySQL. I need to create a process definition which process continous events from external systems. I tried to create the process definition as following: Start - Wait - Dispatcher - Process1 .+- Process2 (Process2 starts from Dispatcher. The dots are used to align the graph) Initially the process instance will stop at Wait state. When the event arrvies, it will continue its journey to Dispatcher, then Process1, return to Dispatcher then visit Process2. After the event has be processed, the token will be returned to Wait, and wait for next event by suspending the token. After suspending, it will return to caller, processInstance.save() and sleep for a while. Next time when the event arrives, I wake up the thread, I will resume() and signal() the token to move again. I tried to create two Child Token to execute the processes, after that I will move the token from Dispatcher to Wait, and suspend the process. I need to separate Process1 and Process2 because of user requirement. Currently I have implemented a small test program to see if this method works, somehow it works as we are expected. But when the no. of event arrives increases, the processing speed increases. My experience is that after a thousand events have been triggered, the processing time required will be inceased to one second. Howeve, initially it takes only 1/3 seconds or so to process it (Just a feeling, I haven't use any tools to measure it) Be honest I am not sure if what I am doing is correct. We needs to stuck with the graph of the Process Definition stated above, and the concept of looping. Please help. Philip View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3926422#3926422 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3926422 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user