[jBPM Users] - Starting process instance by key
by bestage
Today in a project we are currently doing, I was suprised to find out that startProcessInstanceByKey(procDefId, key) allows to use the same key many times. Although it is clear that this is intended to be a business key,
I still wonder why it is not forced to be unique.
I actually planned to use this key as some sort of locking mechanism to lock the business object used by a process against being used in another process instance. Thus if I'd start another process instance with the same key whilst the previous one is running, I'd expect to get an exception.
Now, the only work around seems to be to check before starting a new process instance, if another process instance is running with the same key and not allow to start the new instance until the previous one is finished.
Does anyone have a better idea?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258755#4258755
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258755
16 years, 6 months
[jBPM Users] - Re: Ending task with timer - session is closed
by Jimmy56
Ok,
nobody met same issue? With mentioned configuration it seems that helped us to disable cureent session for persistence service - by changing in jbpm.configuration.xml:
| <service name="persistence">
| <factory>
| <bean class="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory">
| <field name="isTransactionEnabled"><false/></field>
| <field name="isCurrentSessionEnabled"><false/></field>
| </bean>
| </factory>
| </service>
|
It helped in earlier described case, but seems it happens in another scenarios which I need to scan more in detail later.
Also I think I need to specify configuration more precisely , which contains jbpm deployed twice - once in our application and once within default deployment which comes with JBoss SOA Platform 4.3 which we are using. Job executor is configured in default jbpm deployment, not in our application.
But my knowledge of JBPM and Seam is not so deep to know what and why it happens, so if anybody can give an explanation, it will be appreciated.
Jakub.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258613#4258613
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258613
16 years, 6 months
[jBPM Users] - jbpm 4.1 - execution not waiting for Task Form inputs
by makarandk502
Hi,
Simple process definition( with a taskform ) when run using jbPM APIS is not getting stopped at task form node but it completes its execution.
I am trying to test the process using jBPM APIs not console.
Code attached below for reference.
Process should wait for user inputs through a form which is attached to "review" task. I also tried removing line " taskService.completeTask(task.getId());"
from jbpm test case but no sucsess.
Can anybody guide me in this regard ?
Process definition :
| <?xml version="1.0" encoding="UTF-8"?>
|
| <process name="FormDynamic" xmlns="http://jbpm.org/4.0/jpdl">
|
| <start g="20,20,48,48">
| <transition to="review"/>
| </start>
|
| <task assignee="peter" form="org/jbpm/examples/formdynamic/givedetails.ftl" g="96,16,127,52" name="review">
| <transition to="wait"/>
| </task>
| <state g="268,24,96,31" name="wait"/>
|
| </process>
|
jbpm test case :
| package org.jbpm.examples.formdynamic;
|
| import java.util.HashMap;
| import java.util.List;
| import java.util.Map;
|
| import org.jbpm.api.ProcessInstance;
| import org.jbpm.api.task.Task;
| import org.jbpm.test.JbpmTestCase;
|
| public class FormDynamicTest extends JbpmTestCase {
| String deploymentId;
|
| protected void setUp() throws Exception {
| super.setUp();
|
| deploymentId = repositoryService.createDeployment()
| .addResourceFromClasspath("org/jbpm/examples/formdynamic/FormDynamic.jpdl.xml")
| .deploy();
| }
|
| protected void tearDown() throws Exception {
| repositoryService.deleteDeploymentCascade(deploymentId);
|
| super.tearDown();
| }
|
| public void testTaskAssignee() {
| Map<String, Object> variables = new HashMap<String, Object>();
| variables.put("order", "johndoe");
| ProcessInstance processInstance = executionService.startProcessInstanceByKey("FormDynamic", variables);
| String pid = processInstance.getId();
| //ProcessInstance processInstance = executionService.startProcessInstanceByKey("FormDynamic");
| List<Task> taskList=taskService.findPersonalTasks("peter");
| Task task=taskList.get(0);
|
| taskService.completeTask(task.getId());
|
| System.out.println("List is"+taskList);
|
| // verify that process moved to the next state
| processInstance = executionService.findProcessInstanceById(pid);
| assertTrue(processInstance.isActive("wait"));
|
|
|
| }
| }
|
jbpm test case result :
| 14:31:37,940 FIN | [BaseJbpmTestCase] === starting testTaskAssignee =============================
| 14:31:38,231 INF | [Environment] Hibernate 3.3.1.GA
| 14:31:38,231 INF | [Environment] hibernate.properties not found
| 14:31:38,231 INF | [Environment] Bytecode provider name : javassist
| 14:31:38,231 INF | [Environment] using JDK 1.4 java.sql.Timestamp handling
| 14:31:38,271 INF | [Configuration] configuring from resource: jbpm.hibernate.cfg.xml
| 14:31:38,271 INF | [Configuration] Configuration resource: jbpm.hibernate.cfg.xml
| 14:31:38,321 INF | [Configuration] Reading mappings from resource : jbpm.repository.hbm.xml
| 14:31:38,441 INF | [Configuration] Reading mappings from resource : jbpm.execution.hbm.xml
| 14:31:38,541 INF | [Configuration] Reading mappings from resource : jbpm.history.hbm.xml
| 14:31:38,591 INF | [Configuration] Reading mappings from resource : jbpm.task.hbm.xml
| 14:31:38,621 INF | [Configuration] Reading mappings from resource : jbpm.identity.hbm.xml
| 14:31:38,631 INF | [Configuration] Configured SessionFactory: null
| 14:31:38,651 INF | [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
| 14:31:38,651 INF | [DriverManagerConnectionProvider] Hibernate connection pool size: 20
| 14:31:38,651 INF | [DriverManagerConnectionProvider] autocommit mode: false
| 14:31:38,651 INF | [DriverManagerConnectionProvider] using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:mem:.
| 14:31:38,651 INF | [DriverManagerConnectionProvider] connection properties: {user=sa, password=****}
| 14:31:38,791 INF | [Dialect] Using dialect: org.hibernate.dialect.HSQLDialect
| 14:31:38,791 INF | [TransactionFactoryFactory] Using default transaction strategy (direct JDBC transactions)
| 14:31:38,801 INF | [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
| 14:31:38,801 INF | [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
| 14:31:38,831 INF | [SessionFactoryImpl] building session factory
| 14:31:39,322 INF | [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
| 14:31:39,332 INF | [SchemaExport] Running hbm2ddl schema export
| 14:31:39,332 INF | [SchemaExport] exporting generated schema to database
| 14:31:39,362 INF | [SchemaExport] schema export complete
| 14:31:39,793 FIN | [ProcessDefinitionImpl] creating new execution for process 'FormDynamic'
| 14:31:39,793 FIN | [DefaultIdGenerator] generated execution id FormDynamic.1
| 14:31:39,813 FIN | [ScopeInstanceImpl] create variable 'order' in 'execution[FormDynamic.1]' with value 'johndoe'
| 14:31:39,813 FIN | [ExecuteActivity] executing activity(17872448)
| 14:31:39,813 FIN | [ExecuteActivity] executing activity(review)
| 14:31:39,843 FIN | [TaskQueryImpl] select task from org.jbpm.pvm.internal.task.TaskImpl as task where task.assignee = :assignee order by task.priority desc
| 14:31:39,853 FIN | [TaskQueryImpl] setting parameter assignee: peter
| 14:31:39,863 FIN | [Signal] signalling activity(review), signalName=completed
| 14:31:39,863 FIN | [ExecuteActivity] executing activity(wait)
| List is[Task(review)]
| 14:31:39,903 FIN | [DbSessionImpl] deleting history process instance FormDynamic.1
| 14:31:39,923 FIN | [DbSessionImpl] deleting process instance FormDynamic.1
| 14:31:39,923 FIN | [DeleteDeploymentCmd] deleting deployment 1
| 14:31:39,953 FIN | [BaseJbpmTestCase] === ending testTaskAssignee =============================
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258605#4258605
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258605
16 years, 6 months