[jBPM Users] - Action associated with timer is not invoked
by jbosspnet
Hi, I am using Jbpm 3.2.3 on Jboss 4.2.3.GA.
I have the following simple process:
<?xml version="1.0" encoding="UTF-8"?>
|
| <process-definition xmlns="" name="sample">
| <start-state name="start">
| <transition to="state"></transition>
| </start-state>
|
| <state name="state">
| <timer name="two-seconds" duedate="2 seconds" transition="to-decision">
| <action name="handler" class="sample.TimerHandler"></action>
| </timer>
| <transition to="decision" name="to-decision"></transition>
| </state>
|
| <decision name="decision">
| <handler class="sample.MyDecisionHandler"></handler>
| <transition to="end" name="OK"></transition>
| <transition to="state" name="KO"></transition>
| </decision>
|
| <end-state name="end"></end-state>
|
| </process-definition>
|
The idea is that I perform a check in TimerHandler every 2 seconds, then I set some variable that MyDecisionHandler will use to take "OK" or "KO" transition.
I have deployed the process archive with the two classes (TimerHandler and MyDecisionHandler) and then I use jbpm console to signal process.
When I enter to "state" state and I click signal, the class action associated to the timer (sample.TimerHandler) will never be called.
Why? I have to do other things to creater timer or is a configuration problem in jbpm.cfg.xml? I have added the entry:
<bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor" singelton="true" />
and jbpm-enterprise.jar is deployed in Jboss.
Regards.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262183#4262183
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262183
16 years, 5 months
[jBPM Users] - Re: Using Process variables as parameters for method calls
by sebastian.s
Hello again!
>From the documentation about java activities:
| <process name="Java" xmlns="http://jbpm.org/4.0/jpdl">
|
| <start >
| <transition to="greet" />
| </start>
|
| <java name="greet"
| class="org.jbpm.examples.java.JohnDoe"
| method="hello"
| var="answer"
| >
|
| <field name="state"><string value="fine"/></field>
| <arg><string value="Hi, how are you?"/></arg>
|
| <transition to="shake hand" />
| </java>
|
| <java name="shake hand"
| expr="#{hand}"
| method="shake"
| var="hand"
| >
|
| <arg><object expr="#{joesmoe.handshakes.force}"/></arg>
| <arg><object expr="#{joesmoe.handshakes.duration}"/></arg>
|
| <transition to="wait" />
| </java>
|
| <state name="wait" />
|
| </process>
|
anonymous wrote :
| For the java task you can pass arguments and use expressions for the value of the arguments. These can afaik be process variable names as well, so that solves one problem. The varying number of arguments is afaik dealt with by jBPM since it uses reflection to find the correct method signature. Not 100% completely sure though.
|
How exactly can I address process instance variables to use them as arguments for method calls?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262166#4262166
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262166
16 years, 5 months
[jBPM Users] - JBPM process timers in Multi Server deployment -3.2.6
by sarish
Excuse me for the post, but have done enough searches and dont find info regarding this. Help needed!!
I am hitting some issues related to using EJB Timer service for deployment, i have used Out of the box config recommended for enterprise deployment.
First the details of Deployment
1. 3 jboss 5.1.0 servers hitting the same database
2. Using JBPM 3.2.6SP1
3. Oracle is database.
4. Using Database persisted timers(ejb2 timers), in the same database table TIMERS on all servers, below is the jbpm.cfg.xml
| <jbpm-configuration>
|
| <jbpm-context>
| <service name="persistence" factory="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory" />
| <service name="message" factory="org.jbpm.msg.jms.JmsMessageServiceFactory" />
| <service name="scheduler" factory="org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory" />
| <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
| <!-- <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />-->
| <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
| </jbpm-context>
|
| <!-- use the context class loader
| <string name="jbpm.classLoader" value="context" />-->
|
| <!--
| Note, that the default job executor needs to be overwritten with a null value.
| In the enterprise configuration there should be no job executor.
| Async messaging is there bound to jms and scheduling to ejb timers.
| -->
| <null name="jbpm.job.executor" />
|
| </jbpm-configuration>
|
|
EJB timer configuration is standard with database persistence JNDI name changed to Oracle database.
Issues/Observations
1. I see no issues with async continuations(have 2-3 such async exclusive nodes in my process definition)
2. But for timers,
a) Every once in a while these errors show up in server console,I see that this stack is present in more than one servers (which shows the timer fired on more than one server).
b) On server startup StaleObject Exception related to timer save are seen in plenty.Note only one server is started and stopped at a time.
I definitely feel that something is wrong with the way it is deployed, as when i looked into EJBTimerService code and i see that on server startup all timers persisted are deleted and reinserted. At this point if some other server already had a timer assigned(it is a thread based implementation), that timer would continue to run and another one would be started on server just restarted as well. And when time comes to fire, both servers would fire the timer. This would result in staleobject exception and hence certainly cause a problem.
Sorry if my post was not clear, as i have avoided lot of details so that the post is readable. I can provide more info as required. But please recommend if something can be done for this. Also it can be treated as more of a problem with EJBTimerService, but again i am looking at ways in which i can make JBPM timers work in multi server environment. I can not use local database hsql, as that is not allowed in production enviroment.
Worst case i am thinking of implementing a SingleServerPersistencePlugin for timers, and add an additional column with the server owner name, so that restoreTimers is clearly separated from all other servers. There is a definite problem with failover in such implementation but better get something working then nothing.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262109#4262109
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262109
16 years, 5 months
[jBPM Users] - JBPM / Spring - issue persisting data within thread
by funkymac
Problem
We use a thread pool to start workflows so that we do not block our process that kicks off the workflow (FixedThreadPool). Problem is that data being persisted within the actual workflow java task is not being seen outside of the thread that executes the workflow. The workflow java task is a spring bean that has our DAO injected and the DAO is injected with the SessionFactory. If we do not use a thread pool (just start workflow from same thread and block) then everything works fine.
FYI, I have tried using current="true" with spring-transaction-interceptor (not using job executor) but I get the error - No existing transaction found for transaction marked with propagation 'mandatory'. I've also tried using job executor along with continue="async" in workflow java task instead of using my own thread pool but this produces a NULL pointer exception in org.jbpm.pvm.internal.jobexecutor.JobExecutorMessageSession.send (looked at source and looks like transaction is null for call to transaction.registerSynchronization()).
I've have spent a good number of hours sifting through the forum, documentation, and source code along with trying various things but have yet to resolve this problem. Configuration details below. Any help is greatly appreciated!
Environment
JBPM 4.1, Hibernate 3.3.1, Spring 2.5.6, HSQLDB
Test Case extending AbstractTransactionalDataSourceSpringContextTests
JPDL (partial)
<java expr="#{copyWorkflowTask}" g="50,175,92,52" method="execute" name="copy">
| <arg>
| <object expr="#{execution}"/>
| </arg>
| <transition g="-52,-18" name="to ingestComplete" to="ingestComplete"/>
| </java>
|
SPRING CONFIG (partial)
| <tx:annotation-driven mode="aspectj" proxy-target-class="false"/>
| <tx:annotation-driven/>
|
| <!-- packages to scan for component DI -->
| <context:component-scan base-package="com.xxx.xxx"/>
|
| <!-- Use Annotation and AspectJ driven transactions -->
| <bean class="org.springframework.transaction.aspectj.AnnotationTransactionAspect"
| factory-method="aspectOf"
| lazy-init="false">
|
| <property name="transactionManager" ref="transactionManager"/>
| </bean>
|
| <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
| <constructor-arg>
| <ref local="sessionFactory"/>
| </constructor-arg>
| </bean>
|
| <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
| <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
| <property name="url" value="jdbc:hsqldb:file:latch.db;create=true"/>
| <property name="initialSize" value="1"/>
| <property name="maxActive" value="10"/>
| </bean>
|
| <!-- hibernate session factory -->
| <bean id="sessionFactory"
| class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
| <property name="dataSource">
| <ref local="dataSource"/>
| </property>
| <property name="packagesToScan" value="com.mti.latch.model"/>
| <property name="hibernateProperties">
| <props>
| <prop key="hibernate.hbm2ddl.auto">create-drop</prop>
| <prop key="hibernate.show_sql">false</prop>
| <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
| <prop key="current_session_context_class">thread</prop>
| </props>
| </property>
| <property name="configLocations">
| <list>
| <value>classpath:hibernate.cfg.xml</value>
| </list>
| </property>
| <property name="mappingLocations">
| <list>
| <value>classpath:jbpm.execution.hbm.xml</value>
| <value>classpath:jbpm.repository.hbm.xml</value>
| <value>classpath:jbpm.task.hbm.xml</value>
| <value>classpath:jbpm.history.hbm.xml</value>
| </list>
| </property>
| </bean>
|
| <aop:aspectj-autoproxy/>
|
| <tx:advice id="txAdvice" transaction-manager="transactionManager">
| <tx:attributes>
| <tx:method name="*" propagation="REQUIRED"/>
| </tx:attributes>
| </tx:advice>
|
| <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
| <constructor-arg value="jbpm.cfg.xml"/>
| </bean>
|
| <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine"/>
|
| <!-- handles access to our database -->
| <bean id="coreDao" class="com.xxx.HibernateCoreDao">
| <property name="sessionFactory" ref="sessionFactory"/>
| </bean>
|
| <!-- workflow dao wrapper, wraps calls to JBPM -->
| <bean id="workflowDao" class="com.xxx.JbpmWorkflowDao">
| <property name="processEngine" ref="processEngine"/>
| </bean>
|
| <!-- workflow service wrapper, handles kicking off workflow for a given file -->
| <bean id="ingestWorkflowService" class="com.xxx.IngestWorkflowServiceImpl">
| <property name="coreDao" ref="coreDao"/>
| <property name="workflowKey" value="testInjestProcess"/>
| <property name="workflowDefinition" value="test.injest.jpdl.xml"/>
| <property name="workflowDao" ref="workflowDao"/>
| <constructor-arg value="2"/>
| </bean>
|
| <!-- copy workflow task - called by workflow engine, wraps copy ingestor that
| performs the actual copying of a file -->
| <bean id="copyWorkflowTask" scope="prototype" class="com.xxx.WorkflowTask">
| <property name="baseDirectory" value="target//"/>
| <property name="coreDao" ref="coreDao"/>
| <property name="ingestor" ref="copyIngestor"/>
| <property name="ingestStateTypeValue" value="copying"/>
| </bean>
|
|
| <!-- copy ingestor - handles copying of file -->
| <bean id="copyIngestor" scope="prototype" class="com.xxx.CopyIngestor">
| </bean>
|
JBPM CONFIG (complete)
| <jbpm-configuration>
| <import resource="jbpm.jpdl.cfg.xml" />
| <import resource="jbpm.identity.cfg.xml" />
|
| <process-engine-context>
| <repository-service />
| <repository-cache />
| <execution-service />
| <history-service />
| <management-service />
| <identity-service />
| <task-service />
|
| <command-service>
| <retry-interceptor />
| <environment-interceptor />
| <spring-transaction-interceptor/>
| </command-service>
|
| <script-manager default-expression-language="juel"
| default-script-language="juel"
| read-contexts="execution, environment, process-engine, spring"
| write-context="">
|
| <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
| </script-manager>
|
| <id-generator />
| <types resource="jbpm.variable.types.xml" />
| <address-resolver />
| </process-engine-context>
|
| <transaction-context>
| <repository-session />
| <db-session />
| <message-session />
| <timer-session />
| <history-session />
| <mail-session/>
| <hibernate-session current="true" />
| </transaction-context>
| </jbpm-configuration>
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262092#4262092
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262092
16 years, 5 months
[jBPM Users] - Conditional Task Assignment with Fork
by pradeep.gulla
Is it possible to assign conditional tasks with Fork node in JBPM.
As per my requirement, workflow should allow optional Parallel tasks and a mandatory sequential task.
But I'm getting some issues while conditionally assign tasks with fork.
Process definition:
| <?xml version="1.0" encoding="UTF-8"?>
| <process name="conditional_task" version="1" xmlns="http://jbpm.org/4.0/jpdl">
| <start g="27,32,80,40">
| <transition to="Validate Approval Seqence"/>
| </start>
| <!-- Checks which sequence to initiate ie., Either Parallel or Sequential -->
| <decision expr="#{isOptionalTasksExists}" name="Validate Approval Seqence" g="257,31,80,40">
| <transition name="true" to="Assign Parallel Tasks" g="-24,2"/>
| <transition name="false" to="Sequential Task" g="564,54:-75,-21"/>
| </decision>
| <!-- Parallel Task Assignment -->
| <fork name="Assign Parallel Tasks" g="258,139,80,40">
| <transition to="validateFirstParallelTask"/>
| <transition to="validateSecondParallelTask"/>
| </fork>
| <!-- Conditional Task Assignment -->
| <decision name="validateFirstParallelTask" g="135,221,80,40">
| <transition to="First Parallel Task">
| <condition expr="#{firstParallelApprover != null}"/>
| </transition>
| </decision>
| <task assignee="#{firstParallelApprover}" name="First Parallel Task" g="71,325,169,40">
| <transition name="Approve" to="wait for other tasks" g="-45,-18"/>
| </task>
| <decision name="validateSecondParallelTask" g="384,221,80,40">
| <transition to="Second Parallel Task">
| <condition expr="#{secondParallelApprover != null}"/>
| </transition>
| </decision>
| <task assignee="#{secondParallelApprover}" name="Second Parallel Task" g="308,324,204,40">
| <transition name="Approve" to="wait for other tasks" g="-45,-18"/>
| </task>
| <join name="wait for other tasks" g="270,436,80,40">
| <transition to="Sequential Task"/>
| </join>
| <!-- Sequential Task -->
| <task assignee="#{sequentialApprover}" name="Sequential Task" g="494,437,147,40">
| <transition name="Approve" to="Finish" g="-45,-18"/>
| </task>
| <end name="Finish" state="Completed" g="778,431,80,40"/>
| </process>
This definition forces me to supply either (2 Parallel and 1 Sequential) or (0 Parallel and 1 Sequential) approvers, but not 1 Parallel and 1 Sequential.
Thanks in Advance
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262014#4262014
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262014
16 years, 5 months