PDA

View Full Version : jbpmTemplate and multiple process Defintions



jmjava
Aug 28th, 2006, 08:43 AM
It appears that the current JbpmTemplate implementation can only service one processDefinition. Is there a reason for this design? The jbpmConfiguration object can load more than one processDefinition it would be nice if jbpmTemplate could handle this. Currently it looks like i have to create a bean defining a jbpmTemplate for each processDefinition i want to deploy.

Any comments?

Costin Leau
Aug 28th, 2006, 09:16 AM
The JbpmTemplate loads a single process definition only for two operations - for the rest the id of the process instance is required.
You can have a jbpmTemplate per processInstance to use it as default - however, using the same instance of jbpmTemplate with multiple instances require some sort of discriminator to distinguish between them and right now these are given as params to the Template method calls.

jmjava
Aug 28th, 2006, 10:17 AM
The JbpmTemplate loads a single process definition only for two operations - for the rest the id of the process instance is required.
You can have a jbpmTemplate per processInstance to use it as default - however, using the same instance of jbpmTemplate with multiple instances require some sort of discriminator to distinguish between them and right now these are given as params to the Template method calls.

thanks for clearing that up Costin. We are in the planning phases of our application and i'm just kicking the tires on JbpmTemplate now. Nice work :)

I envision having multiple processes deployed in the system. So i think i am going to need to go with option 2 that you described.

Are you saying that the descriminator support is already in the code base?

I see methods like

public ProcessInstance findProcessInstance(final Long processInstanceId)

i can see that the processInstanceId would only be associated with one Process Defintion so this could work as a defacto descriminator

but for methods like this in the template:

public List findPooledTaskInstances(final String actorId)

a descriminator would have to be added to the method signature correct?


-jm

Costin Leau
Aug 28th, 2006, 02:51 PM
public List findPooledTaskInstances(final String actorId)

a descriminator would have to be added to the method signature correct?
Take a look at the sources - this is a generic call to the Jbpm context so a discriminator is not required. The default jbpmTemplate process definition is used inside findProcessInstances method alone. Note that one can access the Jbpm native API directly by using a JbpmCallback.

clandestino_bgd
Oct 31st, 2006, 12:19 PM
Dear community,
I am trying to use Spring JBPM module for my application based on appfuse. I have followed the Appfuse WIKI tutorial and read all posts on this forum along with JIRA issues.

My problem is the following. I have to allow users to:
- upload process definition in runtime
- delete process definition in runtime
- edit process definition in runtime by setting appropriate users/groups

I have studied JBPMTemplate and configuration files and as far as I could see I have two options by default:
1. set one process definition
2. provide list of process definitions by using Resource Loader.
However, both options assume that process definitions are static and if I want to deploy new process definition, I have to restart the application.

This limitation worries me a little bit, so before I dig into source, i would like to ask, if someone had the same requirement and what would be the best way to overcome this limitation.

Thank you in advance
Regards
Milan

Costin Leau
Nov 11th, 2006, 06:14 AM
Actually, if you look at the sources, you'll notice that the process definition is used in only one method. I thinking of removing this from the template since, as in your case, it creates confusion most of the times.
Note that you can add process definitions directly, by working against the native API through a Jbpm Callback.

P.S. I've found your thread by accident - next time start a new one please.

clandestino_bgd
Nov 12th, 2006, 07:50 AM
Dear Costin,
thank you for your answer.
I have almost lost a hope that anyone will respond.
In the meanwhile, I have played with spring modules 0.6 nad JBPM.
Deploy process def works very nice.
I have added some methods in JBPM template. One developer actually suggested that in this forum, but you said that it would bring additional complexity.
Also, I have removed process definition property from Factory and JBPM template mappings and it works OK, since you provided constructors without process definition as parameter.

Thank you for the nice work.
I will come back with some new questions these days.

Regards
Milan Agatonovic

Costin Leau
Nov 12th, 2006, 09:17 AM
Thanks for the nice words.


I have added some methods in JBPM template. One developer actually suggested that in this forum, but you said that it would bring additional complexity.
the idea of jbpmTemplate is to be simple - most of the methods are used in a specific case and are not generic - the api should be small and simple so that even newbies can start working with it right away.

P.S. I've been away w/o internet access and that's why I gave the forum a 'break'.