-
1. Re: working with jbpm
sforema Dec 13, 2005 2:24 PM (in response to forjbpm)"I am just not able to see that transition from one state to next state"
How are you looking for it? Are you querying the database?
You can use the query below to check the status of non-completed processes:
> This will show one row for each instance + token + context variable
Keep in mind that you will need to begin and commit a transaction to persist the process instance to the database.
Also be aware that since the transaction is "outside" jBPM, state is not saved until jBPM returns which is either at completion of the entire process or it goes into a wait state. ie: jBPM does NOT persist state as it moves within itself, unless you make it thru custom code ;-).
select
def.id_ as def_id,
def.name_ as def_name,
def.version_ as def_version,
instance.id_ as instance_id,
instance.start_ as instance_start,
instance.end_ as instance_end,
token.id_ as token_id,
token.nodeenter_ as token_enter,
node.id_ as node_id,
node.name_ as node_name,
node.class_ as name_class,
var.name_ as var_name,
var.stringvalue_ as var_value
from
jbpm_processinstance instance,
jbpm_processdefinition def,
jbpm_token token
left outer join jbpm_variableinstance var
on token.id_ = var.token_,
jbpm_node node
where
instance.end_ is null
and instance.processdefinition_ = def.id_
and instance.roottoken_ = token.id_
and token.node_ = node.id_ -
2. Re: working with jbpm
forjbpm Dec 14, 2005 11:36 AM (in response to forjbpm)Hi sforema,
Thanks a lot for quick answers!How are you looking for it? Are you querying the database?
I was assuming that in my actionHandler if I say
executionContext.leavenode() ; My processDefinition will leave the current node and move to next one. and I will be able to see it in browser.
Do you have your own interface to watch this processtransitions?
Again, Thanks a lot!
I am just trying to clear all my doubts. I have worked with other opensourse workflow products but this one is taking time..(May be because I am still trying to relate it to other products!) -
3. Re: working with jbpm
sforema Dec 14, 2005 2:22 PM (in response to forjbpm)I do indeed have my own process monitor, which is essentially a more fancy query than I provided here.
I have added several context variables to allow me to add detailed state information to a process, such as ERROR, PAUSED, INACTIVE, ACTIVE, PAUSING, COMPLETED. I am able to see the status of each token in the job, pause the job, signal a token, end the job, and restart a token on the same step. When a token errors out, it also provides restart information and error information in a comment as well.
All of this only works if you jBPM to save state in each node, which is considered by many to be a naughty, evil thing, but it can be done...
Ltr,
Sean -
4. Re: working with jbpm
sforema Dec 14, 2005 2:30 PM (in response to forjbpm)Also, leaveNode is not probably what you want.
I think the documentation is not clear on your real options are.
You essentially have two types of nodes: ones that automatically transition (fork,join) and ones that do not (state).
It is very important to know what each node does. If you signal a node that doesn't need it, you will get some VERY bizarre behaviour.
It is also important to know that if you are dealing with a fork, signalling the process is not your best approach, but instead, you signal the appropriate tokens.
I have chosen to customize a node to automatically signal based on the response from a subclass method. If the method on the subclass exits normally, it signals. If the method throws an exception, I leave the node in a wait state (no signal).
In other words, use signal, but be aware that if you introduce a fork/join, things will get more complicated. -
5. Re: working with jbpm
ralfoeldi Dec 14, 2005 3:14 PM (in response to forjbpm)I have to find that link on why Oracle never, ever does dirty reads... It has a reason... :-)
(For the rest of you: this is a running gag between Mr. Sean Autocommit and myself.)
Btw: Is there any situation in which you would accept transactions spanning nodes? Just curious. I do have the impression you know what you're doing, which just makes it all the more puzzleing for me.
Greetings
Rainer -
6. Re: working with jbpm
sforema Dec 14, 2005 6:05 PM (in response to forjbpm)There will never be a situation where I will span multiple nodes without saving state.
To me, each node is a step in a job. In that light, it is critical to know exactly where the process is so that work is not done twice in case of a power / machine failure. The first node might pick up a file. It might span three asynch processes to process that file differently. After the join, a report may be produced. I need to be able to monitor exactly where everything is and provide the facility to restart a job, step, or pause all jobs if need be. This requires me to save state 2 times in each node: upon entry and after the work is complete.
The nice thing is that I can later build an issue tracking system with jBPM as well and have one place that holds all our business processes, both batch, and issue management. This moves us close to a "BAM" (I hate that term) / Dashboard solution where we can see everything that is going on in our business and monitor it realtime.
Without accurate node persistance, I do not see how this is possible.
you asked...
Sean -
7. Re: working with jbpm
forjbpm Jan 11, 2006 12:50 PM (in response to forjbpm)Also be aware that since the transaction is "outside" jBPM, state is not saved until jBPM returns which is either at completion of the entire process or it goes into a wait state. ie: jBPM does NOT persist state as it moves within itself, unless you make it thru custom code ;-).
But at any given time my database is always empty. (Even process is fininshed or its in wait state) Am I missing something?Keep in mind that you will need to begin and commit a transaction to persist the process instance to the database.
If I start my process, at a given node I am not able to begin or commit transaction as in my action handler execution context I dont see current jbpmsession. (??) and If I get it from JbpmSessionFactory it throws obbvious error oforg.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
So I am really not able to figure out how should I proceed.
Any leads in this regard??
Thanks a lot in advance! -
8. Re: working with jbpm
ralfoeldi Jan 11, 2006 1:24 PM (in response to forjbpm)But at any given time my database is always empty. (Even process is fininshed or its in wait state) Am I missing something?
This is most definately not true. The definitions, processinstances, state etc. have to be somewhere or else you couldn't use them. Sorry for stating the obvious.If I start my process, at a given node I am not able to begin or commit transaction as in my action handler execution context I dont see current jbpmsession. (??) and If I get it from JbpmSessionFactory it throws obbvious error of ... Illegal attempt to associate a collection with two open sessions
proves the point. Hibernate does not allow you to attach an object to two sessions => Hibernate has the object => its in A database.
The question now is which database. HSQL? I never used the starter kit or the default configs etc. but I guess thats what your problem is.I am not able to begin or commit transaction as in my action handler execution context
Well.. you shouldn't do transaction handling inside of an actionHandler. The transaction wraps the execution, possibly with a whole lot of actions. Where ever you get the Token / ProcessInstance that you signal() is where your transaction handling should be. Or maybe not even there if you're using container managed transactions.
Hope this points you in the right direction.
Rainer -
9. Re: working with jbpm
forjbpm Jan 11, 2006 2:05 PM (in response to forjbpm)Thanks a lot for your reply
This is most definately not true. The definitions, processinstances, state etc. have to be somewhere or else you couldn't use them. Sorry for stating the obvious.
I agree with you that processInstances, etc have to be somewhere .. ( thats why I called Hibernate exception as it throws obbvious error of ... Illegal attempt to associate a collection with two open sessions
) But when I query my database I really dont see anything. Yes, I am using HSQL database and starters kit.
I -
10. Re: working with jbpm
ralfoeldi Jan 11, 2006 2:21 PM (in response to forjbpm)are you sure you are querying the same database instance as jbpm is?
jbpm sees something, you don't. so unless databases have changed alot lately and become moody beasts you must be looking at different things.
could it be that you are just looking in the wrong place?
hsql can be run as an in-memory-db. are your processInstances still there after you restart the app? -
11. Re: working with jbpm
forjbpm Jan 11, 2006 3:23 PM (in response to forjbpm)yeh! I am quite sure of the database I am looking for.
and Thats why its driving me crazy now. In case of Test class It behaves as expected.
But When I run my process, I dont see any interaction with my hsql database during or after the process execution. -
12. Re: working with jbpm
forjbpm Jan 11, 2006 6:18 PM (in response to forjbpm)In case websale example, When I run it and create a new web sale order it is supposed to update JBPM_TIMER table if I am not wrong ! But In my case I dont see this logging in table (Here I unserstand that once ernie fininshes his task this entry will be deleted)
Any help in this regard is highly appreciated. -
13. Re: working with jbpm
enazareno Jan 11, 2006 6:43 PM (in response to forjbpm)Hi,
Try using another database. You wont be using hsqldb in production anyway (unless you really do) ;)
Regards,
Elmo -
14. Re: working with jbpm
forjbpm Jan 12, 2006 11:18 AM (in response to forjbpm)Oh! G8!
Actually I got this information regarding websale example database from one of your posts only :-)
If you think its going to help me if I use another database then I will go ahead and try it( My manager is really loosing his patience now :-)).
Is there anything more anyone would like me to know regarding using database other than hsql?? (In advance)
Thanks!