[JBoss jBPM] - Variable and Looking Up Token
by bradsdavis
I have a pattern I am trying to use to asynchronously signal a process to continue. Unfortunately, because I need to do this between clusters and to a particular queue, I am not able to leverage the "async" attribute in this case.
So, I am trying to figure out how to reference a token, and correlate back to that token when I receive a message in a MDB.
Currently, I took the Token ID and used that to correlate. However, I get ID not found exception when I do the lookup in the MDB.
I am using 3.2.3; I have data on the token that I could use to look the token up through hibernate, but would need some information related to how to query the token when referencing the variables mapped to its instance.
Thanks,
Brad
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4201818#4201818
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4201818
17 years, 2 months
[JBoss jBPM] - JbpmContext usage & best practices
by srLucas
Hi!,
I am using JBPM + Spring (springmodules0.8a) + Struts to create an application.
I would like to know what are the best practices regarding the jbpmContext and how to create it/reuse it.
This is my spring configuration
| <bean id="dc-workflow"
| class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean">
| <property name="definitionLocation"
| value="classpath:dc/processdefinition.xml"/>
| </bean>
|
| <bean id="jbpmConfiguration"
| class="com.ea.dc.core.CustomLocalJbpmConfigFactoryBean">
| <property name="sessionFactory" ref="sessionFactory"/>
| <property name="configuration" value="classpath:jbpm.cfg.xml"/>
| <!-- property name="configuration" value="classpath:jbpm.cfg.xml"/ -->
| <property name="processDefinitions">
| <list>
| <ref local="dc-workflow"/>
| </list>
| </property>
| <property name="processDefinitionsResources">
| <list>
| <value>classpath:dc/processdefinition.xml</value>
| </list>
| </property>
| </bean>
|
| <!-- jBPM template -->
| <bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTemplate">
| <constructor-arg index="0" ref="jbpmConfiguration"/>
| <constructor-arg index="1" ref="dc-workflow"/>
| </bean>
and then I am injecting those beans to a service of mine...
now, whenever I want to do something with the workflow, I do something like:
/** Moves the process forward.
| *
| * @param jobId the process instance id
| * @param transitionId the transition id to select
| */
| public void moveForward(final Long jobId, final String transitionName){
| JbpmContext jbpmContext = getContext();
|
| try {
| ProcessInstance instance = jbpmContext.getProcessInstanceForUpdate(jobId);
|
| instance.signal(transitionName);
| } finally {
| // make sure we save everything
| jbpmContext.close();
| }
| }
as shown in the documentation...
the thing is... I am closing the context every time I leave a service method...
isn't it better to leave it open? Is this a good practice?
I was thinking about using something similar to openSessionInView for the jbpmContext (though I'm not sure how to do it)... will that be better?
Any ideas/pointers would be great!
Thanks a lot,
Lucas
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4201813#4201813
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4201813
17 years, 2 months