[jBPM] - Issue with transitioning a task from an attached timer
by Mukul Tandon
Mukul Tandon [http://community.jboss.org/people/mukult] created the discussion
"Issue with transitioning a task from an attached timer"
To view the discussion, visit: http://community.jboss.org/message/558649#558649
--------------------------------------------------------------
In jbpm 4.2, I am not able to transition a task out from a repeating timer which becomes active when the task is created. I want to monitor some external condition in that timer and when it is met, I want to complete the task because its no more needed. When I'm signalling the transition the task still remains active and the timer.notify() gets fired again after the current notify() is done.
I must not be using the timer or signalling the task correctly. Can anybody provide any input?
Thanks in advance.
Here's the code
<? xml version=+"1.0" encoding=+"UTF-8"?>
++<process description=+"Timer Test Process" key=+"tt" name=+"TimerTest" xmlns=+"http://jbpm.org/4.0/jpdl">
<start g=+"328,116,48,48"> <transition g=+"-122,-18" to=+"Followup"/> </start>
<task g=+"284,230,169,52" name=+"Followup"> <on event="timeout" name="TimerEvent"> <timer duedate="10 minutes" repeat="1 minutes"/> <event-listener class="com.ubs.octane.workflow.bo.process.TestEventListener"/> </on> <transition g="-42,-18" name="Complete" to="Review"/> </task> <task g="288,330,169,52" name="Review"> <transition g="-42,-18" name="Acknowledge" to="end"/> <transition g="468,301:-70,8" name="Reject" to="Followup"/> </task> <end g="345,432,48,48" name="end"/></process> public class TestEventListener implements EventListener { protected int countCalled =0; public void notify(EventListenerExecution execution) throws Exception { countCalled++; if(countCalled>=2){ //Will check some external condition here Application appInstance = Application.getApplicationInstance(UBSConstants.APPLICATION_NAME); ProcessEngine pe= (ProcessEngine)appInstance.getStaticData(WorkflowConstants.JBPM_PROCESS_ENGINE_INSTANCE); ExecutionService es =pe.getExecutionService(); //This is not working es.signalExecutionById(execution.getId()); System.out.println("Done"); } }} +++++++++++++
++
++
+
++++
++
+++++++++
++
+
++++
++
+++++++++++
++
+
++++
++
++++++++
+
++++
++
++++++++++
++++
++
++
++
++
++
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/558649#558649]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months
Re: [jboss-user] [Datasource Configuration] - Could not enlist in transaction on entering meta-aware object! (Posgres + SQLite))
by Fidox 666
Fidox 666 [http://community.jboss.org/people/fidox666] replied to the discussion
"Could not enlist in transaction on entering meta-aware object! (Posgres + SQLite))"
To view the discussion, visit: http://community.jboss.org/message/558644#558644
--------------------------------------------------------------
I think the error was as follows:
1) Data source type "*local-tx-datasource*" does not support multiple data sources (sqlite and postgresql concurrent transactions). The solution here is to change the type of data source from "+*local-tx-datasource*+" to "+*xa-datasource*+"
2) Also sqlite does not support "+*xa-datasource*+" type (specifically the problem with sqlite was that I could not find an sqlite implementation of the class "+*rg.postgresql.xa.PGXADataSource*", (*) maybe you can find one for mysql :) ), so I change the second data source database from sqlite to postgresql.
+
This is my "old" data source file:
*+<datasources>+*
*+<!-- Postgresql -->
+*
*+<local-tx-datasource>
+*
*+<jndi-name>Postgres1DS</jndi-name>
+*
*+<connection-url>jdbc:postgresql://localhost:5432/db0</connection-url>
+*
*+<driver-class>org.postgresql.Driver</driver-class>
+*
*+<user-name>user1</user-name>
+*
*+<password>u1pass</password>+*
*+</local-tx-datasource>
+*
*+
+*
*+<!-- SQLite -->
+*
*+<local-tx-datasource>+*
*+<jndi-name>Sqlite1DS</jndi-name>
+*
*+<connection-url>+**+jdbc:sqlite:${jboss.server.data.dir}${/}db1.db+**+</connection-url>+*
*+<driver-class>org.sqlite.JDBC</driver-class>
+*
*+<user-name>user1</user-name>
+*
*+<password>u1pass</password>
+*
*+<connection-property name="autoReconnect">true</connection-property>
+*
*+</local-tx-datasource>+*
*+</datasources>+*
And this is the "new one":
+*<datasources>*+
+*<!-- Postgresql -->
*+
**
**
**
+* <xa-datasource>*
++*<jndi-name>*+*Postgres1DS*+*</jndi-name>*
+
+
* <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>*
* <xa-datasource-property name="ServerName">localhost</xa-datasource-property>*
* <xa-datasource-property name="PortNumber">5432</xa-datasource-property>*
* <xa-datasource-property name="DatabaseName">*+*db0*+*</xa-datasource-property>*
* <xa-datasource-property name="User">user1</xa-datasource-property>*
* <xa-datasource-property name="Password">u1pass</xa-datasource-property>*
* <track-connection-by-tx></track-connection-by-tx>*
* </xa-datasource>*
*
*+
+*<!--* +*Postgresql*+ *-->*+
**
**
+* <xa-datasource>
*
* <jndi-name>Postgres2DS</jndi-name>
*
* <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
*
**
+* <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
*
+* <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
*
* <xa-datasource-property name="DatabaseName">db1</xa-datasource-property>
*
* <xa-datasource-property name="User">user1</xa-datasource-property>
*
* <xa-datasource-property name="Password">u1pass</xa-datasource-property>
*
* <track-connection-by-tx></track-connection-by-tx>
*
*</xa-datasource>
*
+
So.. what I suggest you is to change the type of your data sources from "local-tx-datasource" to "xa-datasource", as I say (*).. you must to find a mysql implementation of the class "+xa-datasource-class",
+ and finally if you can not found this class, you should change the mysql database to postgresql.
I hope I have been clear enough, if you find another point of view for this problem please let me know, sorry for my poor english.
Best regards..
Fido
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/558644#558644]
Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months