[jBPM] - Duplicate tasks created after completing previous task
by João Guerra
João Guerra [https://community.jboss.org/people/ciberg] created the discussion
"Duplicate tasks created after completing previous task"
To view the discussion, visit: https://community.jboss.org/message/832447#832447
--------------------------------------------------------------
Hi, I have a web application using JBPM 5.4 and the processes have only human tasks.
Sometimes when a task is completed JBPM creates the next task in the workflow in duplicate.
It seems that this is aggravated when multiple users are using the application.
This is the code that I use to complete a task:
BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
try {
Task task = taskService.getTask(taskId);
TaskData taskData = task.getTaskData();
humanTaskClient.complete(taskId, user, null, responseHandler);
responseHandler.waitTillDone(75000);
StatefulKnowledgeSession ksession = JBPMConnectionsInitializer.accessKnowledgeSession(processPackage);
KnowledgeRuntimeLogger logger = JBPMConnectionsInitializer.activateKnowledgeRuntimeLog(ksession);
new JPAWorkingMemoryDbLogger(ksession);
ksession.getWorkItemManager().completeWorkItem(
taskData.getWorkItemId(), null);
logger.close();
...
This is the connection initializer:
public static StatefulKnowledgeSession accessKnowledgeSession(String processPackage) throws Exception {
KnowledgeBase kbase = null;
StatefulKnowledgeSession ksession = null;
EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTANCE_ENTITY_NAME);
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
kbase = readJbpmKnowledgeBase(processPackage);
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
CommandBasedHornetQWSHumanTaskHandler humanTaskHandler = new CommandBasedHornetQWSHumanTaskHandler(ksession);
humanTaskHandler.setConnection(HUMAN_TASK_SERVER_HOST, HUMAN_TASK_SERVER_PORT);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task",humanTaskHandler);
return ksession;
}
The tasks are started with this:
BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
try {
humanTaskClient.start(taskId, user, responseHandler);
responseHandler.waitTillDone(75000);
...
Can you please tell me what is wrong and how can I solve this.
Maybe this is happening because I'm not disposing of the ksession, but if I do that the application fails after completion of the task with a session not available error because it was disposed of.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/832447#832447]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[IronJacamar] - Configure JBoss AS 7.2 to use ironjacamar mail resource adapter
by Jody Schering
Jody Schering [https://community.jboss.org/people/jodt] created the discussion
"Configure JBoss AS 7.2 to use ironjacamar mail resource adapter"
To view the discussion, visit: https://community.jboss.org/message/832519#832519
--------------------------------------------------------------
I'm trying to setup a MDB that listens for mail received message for a particular email address. To do this I'm trying to use the ironjacamar mail-1.0.19.Final.rar resource adapter. Unfortunately, I don't know how to configure JBoss AS 7.2 (EAP 6.1) to use the resource adapter. Does anyone know how to configure Jboss to use this resource adapter?
I think there are 2 steps:
1. Setup the mail-1.0.19.Final.rar as a resource adapter in the standalone.xml
2. Deploy the mail-1.0.19.Final.rar in deployments directory.
Unfortunately I don't know what's needed in the ressource-adapter section of the standalone.xml or if there is any other configuration I need. Any help would be very appreciated.
Here's the information I get from the rar-info.bat script for the rar.
| Archive: | mail-1.0.19.Final.rar |
| JCA version: | 1.5 |
| Type: |
| InBound |
| Reauth: |
| No |
| Compliant: | Yes |
| Native: |
| No |
Structure:
----------
META-INF/
META-INF/MANIFEST.MF
META-INF/ra.xml
ironjacamar-mail.jar
Resource-adapter:
-----------------
Class: org.jboss.jca.adapters.mail.MailResourceAdapter
Config-property: QueueSize (java.lang.Integer)
Activation-spec:
----------------
Class: org.jboss.jca.adapters.mail.inflow.MailActivationSpec
Message-listener: org.jboss.jca.adapters.mail.inflow.MailListener
Required-config-property: mailServer
Required-config-property: mailFolder
Required-config-property: storeProtocol
Introspected Config-property: debug (java.lang.Boolean)
Introspected Config-property: flush (java.lang.Boolean)
Introspected Config-property: maxMessages (java.lang.Integer)
Introspected Config-property: messageSelector (java.lang.String)
Introspected Config-property: password (java.lang.String)
Introspected Config-property: pollingInterval (java.lang.Long)
Introspected Config-property: port (java.lang.Integer)
Introspected Config-property: starttls (java.lang.Boolean)
Introspected Config-property: userName (java.lang.String)
META-INF/MANIFEST.MF:
---------------------
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.4
Created-By: 1.6.0_45-b06 (Sun Microsystems Inc.)
META-INF/ra.xml:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: ra.xml 71556 2008-04-01 13:39:35Z mailto:adrian@jboss.org adrian(a)jboss.org $ -->
<connector xmlns=" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
version="1.5">
<description>JBoss JavaMail Resource Adapter</description>
<display-name>JavaMail Adapter</display-name>
<vendor-name>Red Hat Middleware LLC</vendor-name>
<eis-type>JavaMail Adapter</eis-type>
<resourceadapter-version>7.0</resourceadapter-version>
<license>
<description>
JBoss, Home of Professional Open Source.
Copyright 2011, Red Hat Middleware LLC, and individual contributors
as indicated by the @author tags. See the copyright.txt file in the
distribution for a full listing of individual contributors.
This is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this software; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site: http://www.fsf.org/ http://www.fsf.org.
</description>
<license-required>true</license-required>
</license>
<resourceadapter>
<resourceadapter-class>org.jboss.jca.adapters.mail.MailResourceAdapter</resourceadapter-class>
<config-property>
<config-property-name>QueueSize</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
<config-property-value>1024</config-property-value>
</config-property>
<inbound-resourceadapter>
<messageadapter>
<messagelistener>
<messagelistener-type>org.jboss.jca.adapters.mail.inflow.MailListener</messagelistener-type>
<activationspec>
<activationspec-class>org.jboss.jca.adapters.mail.inflow.MailActivationSpec</activationspec-class>
<required-config-property>
<config-property-name>mailServer</config-property-name>
</required-config-property>
<required-config-property>
<config-property-name>mailFolder</config-property-name>
</required-config-property>
<required-config-property>
<config-property-name>storeProtocol</config-property-name>
</required-config-property>
</activationspec>
</messagelistener>
</messageadapter>
</inbound-resourceadapter>
</resourceadapter>
</connector>
Deployment descriptor:
----------------------
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<resource-adapters>
<resource-adapter>
<archive>mail-1.0.19.Final.rar</archive>
<config-property name="QueueSize">1024</config-property>
<transaction-support>NoTransaction</transaction-support>
</resource-adapter>
</resource-adapters>
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/832519#832519]
Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[jBPM] - Process versioning in jbpm5.4
by Hari Kumar
Hari Kumar [https://community.jboss.org/people/hari6025] created the discussion
"Process versioning in jbpm5.4"
To view the discussion, visit: https://community.jboss.org/message/832505#832505
--------------------------------------------------------------
Hi Team,
I am new to JBPM.As I have a requirement to handle the process versioning logic in my workflow.
For example due to change in the requirements ,I am going to modify the process. After i changed the process according to my new requirement , now if i try to create new instance it will be created for new version of the process. That is taken care by JBPM itself.
After deployment of new process ,the instance id which i created using my older process definition and also it has some of the wait state node in it, If i try to proceed that process instance by loading it using ksession it is refering to new version of the process , instead of taking the older process. Where this processes definitions stored in DB?.How to avoid this using the process versioning.
Can some one please suggest me the way to handle this?
Thanks in advance,
Hari.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/832505#832505]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[jBPM] - LocalTaskService keep using one Entity Manager, Breaks when Database is Restarted
by Thomas Setiabudi
Thomas Setiabudi [https://community.jboss.org/people/thomas.setiabudi] created the discussion
"LocalTaskService keep using one Entity Manager, Breaks when Database is Restarted"
To view the discussion, visit: https://community.jboss.org/message/832416#832416
--------------------------------------------------------------
Hi,
This is similar post to https://community.jboss.org/thread/231488?tstart=0 https://community.jboss.org/thread/231488?tstart=0
Only that it discuss about LocalTaskService here
I use JBPM5.4.Final, and Drools-Spring 5.4.Final in a Web Application.
I create Stateful Knowledge Session and LocalTaskService in the Spring config file, they are created once for the rest of the web application life.
Everything works fine, until the Database Server, MS SQL Server 2008, is restarted.
Which then break the Stateful Knowledge Session and LocalTaskService.
After looking at the LocalTaskService code here
https://github.com/droolsjbpm/jbpm/blob/5.4.x/jbpm-human-task/jbpm-human-... https://github.com/droolsjbpm/jbpm/blob/5.4.x/jbpm-human-task/jbpm-human-...
Local Task Service has TaskServiceSession and then TaskServiceSession has TaskPersistenceManager which contain an EntityManager.
The problem is this EntityManager is acquired from EntityManagerFactory just exactly once.
when the database connection is no longer valid (Because of Database Server restart), it will still use the same EntityManager which will of course throw exception.
My question is, is it a bug? or I use these LocalTaskService Wrongly?
Currently, to keep my application running, I create another class that implements TaskService, and have all the code just like LocalTaskService, the difference is I add a check before doing anything about the task.
This is a sample code:
public void addTask(Task task, ContentData content) {
checkEntityManagerFactory();
session.addTask(task, content);
}
and the checkEntityManagerFactory() implementation:
public void checkEntityManagerFactory() {
if (session != null) {
try {
Query query = session.getTaskPersistenceManager()
.createNewQuery("SELECT 1 FROM Task WHERE id = 0 ");
query.getResultList();
} catch (Throwable e) {
session = service.createSession();
}
} else {
session = service.createSession();
}
}
execute simple select query, when that query throws exception, that means its time to get new EntityManager which in this case is create new TaskServiceSession.
Is it the correct way to do this?
Will this issue fixed in JBPM 6 ?
Any help is appreciated.
Regards,
Thomas Setiabudi
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/832416#832416]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 3 months