[jBPM] - Re: How to complete custom Work Item Handler
by Sukumaran Raghavan
Sukumaran Raghavan [https://community.jboss.org/people/suku_1983] created the discussion
"Re: How to complete custom Work Item Handler"
To view the discussion, visit: https://community.jboss.org/message/732799#732799
--------------------------------------------------------------
Hi,
I had a similar scenario. I took the following approach.
- I created my own DB table for my CustomWorkItemHandler. i maintained the Session ID, Process Instance ID, WorkItem ID, and state (as needed by you). Everytime the workitemhandler is executed, it will update the DB table . Note that it DOES not complete or abort the work item.
- In my case i had an external event to complete the work item. Upon receipt of the event, i loaded the persisted ksession, then performed a completeWorkitem for the specific work item ID. I got the work item ID as part of the external event.
This is basically how the Human task works. I had picked the idea from there. HumanTask however is much more complex; while this is a much more simple case.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/732799#732799]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months
[jBPM] - Re: Is SessionID & ProcessID required to complete WorkItem ?
by Sukumaran Raghavan
Sukumaran Raghavan [https://community.jboss.org/people/suku_1983] created the discussion
"Re: Is SessionID & ProcessID required to complete WorkItem ?"
To view the discussion, visit: https://community.jboss.org/message/732798#732798
--------------------------------------------------------------
Hi Vikas,
I have been using JBPM 5.2 in a similar environment. My understanding is as follows
- Session ID: The session is a global repository where you store common data across processes. This comes into play only when you are using Rule (Which is why is is a knowledge repository). If you are using JBPM purely for execution of workflow (i.e. just graph execution), the JBPM session ID is not of much relavence. I would still recommend you use the same session ID to complete a work item (Just to keep the JBPM data consistent).
- Process ID - This is a unique ID for each process instance. The nodes execute in the context of a process. Hence this is of relavence. When you complete a work item, the work item id is sufficient. This is because, the work item Tables in JBPM DB have a reference to the Process instance id. hence this is known to JBPM.
- Work Item ID : Self explanatory i guess.
Regarding how KSession works in a clustered environment. There are multipe approaches to this. What i have opted for is to use a separate KSession for each process instance. (Purely because i do not use any rules). Other approaches i have come across in the forums are to use a specific KSession for each server instance in your cluster. All processes that execute in a server will use the same ksession. Their process instances will be different.
The approach you take should be based on how you are using JBPM.
Happy working.. Its always hard for the first few who start using a new Technology. But i am sure its worth the effort :)
Cheers !
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/732798#732798]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months
[jBPM] - jBPM5 Database Exception
by pushpak1981
pushpak1981 [https://community.jboss.org/people/pushpak1981] created the discussion
"jBPM5 Database Exception"
To view the discussion, visit: https://community.jboss.org/message/732727#732727
--------------------------------------------------------------
Hi,
I am trying to start multiple processes parallely using multiple threads (Oracle Database) I am facing the following error:
20:48:37,321 INFO [stdout] (Thread-103) Thread StartedThread-103
20:48:37,325 INFO [stdout] (Thread-104) Thread StartedThread-104
20:48:37,328 INFO [stdout] (Thread-103) Hibernate: select hibernate_sequence.nextval from dual
20:48:37,331 INFO [stdout] (Thread-104) Hibernate: select hibernate_sequence.nextval from dual
20:48:37,334 INFO [stdout] (Thread-103) Hibernate: select hibernate_sequence.nextval from dual
20:48:37,335 WARN [org.hibernate.util.JDBCExceptionReporter] (Thread-104) SQL Error: 0, SQLState: null
20:48:37,342 ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-104) Connection is not associated with a managed connection.org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@900b93
20:48:37,339 INFO [stdout] (Thread-103) Hibernate: select hibernate_sequence.nextval from dual
20:48:37,346 ERROR [org.drools.persistence.SingleSessionCommandService] (Thread-104) Could not commit session: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not get next sequence value
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614) [hibernate-entitymanager-3.4.0.GA.jar:]
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226) [hibernate-entitymanager-3.4.0.GA.jar:]
at org.jbpm.persistence.JpaProcessPersistenceContext.persist(JpaProcessPersistenceContext.java:22) [jbpm-persistence-jpa-5.2.0.Final.jar:]
at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:43) [jbpm-persistence-jpa-5.2.0.Final.jar:]
at org.jbpm.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:36) [jbpm-flow-5.2.0.Final.jar:]
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:182) [jbpm-flow-5.2.0.Final.jar:]
at org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:154) [jbpm-flow-5.2.0.Final.jar:]
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:135) [jbpm-flow-5.2.0.Final.jar:]
at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1079) [drools-core-5.3.1.Final.jar:]
at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:306) [drools-core-5.3.1.Final.jar:]
at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:119) [drools-core-5.3.1.Final.jar:]
at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:38) [drools-core-5.3.1.Final.jar:]
at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-5.3.1.Final.jar:]
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:345) [drools-persistence-jpa-5.3.1.Final.jar:]
at org.drools.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:42) [drools-core-5.3.1.Final.jar:]
at com.l1id.UnitTest.AsynchronousInterceptor.access$0(AsynchronousInterceptor.java:1) [classes:]
at com.l1id.UnitTest.AsynchronousInterceptor$1.run(AsynchronousInterceptor.java:15) [classes:]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_03]
Caused by: org.hibernate.exception.GenericJDBCException: could not get next sequence value
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:119) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49) [hibernate-entitymanager-3.4.0.GA.jar:]
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:646) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:620) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:624) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220) [hibernate-entitymanager-3.4.0.GA.jar:]
... 16 more
Caused by: java.sql.SQLException: Connection is not associated with a managed connection.org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@900b93
at org.jboss.jca.adapters.jdbc.WrappedConnection.lock(WrappedConnection.java:151)
at org.jboss.jca.adapters.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:391)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:145) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96) [hibernate-core-3.3.2.GA.jar:]
... 25 more
20:48:37,352 INFO [stdout] (Thread-103) Hibernate: select hibernate_sequence.nextval from dual
20:48:37,449 ERROR [stderr] (Thread-104) Exception in thread "Thread-104" javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not get next sequence value
>From the logs we observed that only one process is completed and other thread goes into an error state. I am using CommandBasedStatefulKnowledgeSession.
Has any one faced similar issue.
Thanks
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/732727#732727]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months
[jBPM] - JBPM5 - Using Signal Events with sub-processes.
by borta_galen
borta_galen [https://community.jboss.org/people/borta_galen] created the discussion
"JBPM5 - Using Signal Events with sub-processes."
To view the discussion, visit: https://community.jboss.org/message/732699#732699
--------------------------------------------------------------
Hi guys,
I have a simple workflow that contains a sub-process. I have a signal event attached to the sub-process which I plan to signal externally,
However, when I attempt to signal the event within eclipse using ksession.signalEvent("SignalProceed", *null*); nothing is happening and the process is not moving on.
I have searched around and can not find much / if any information or examples of how to invoke events attached to sub-processes,
I’ve attached my BPMN2 file and am invoking the process via Eclipse using:
*public* *void* test_SignalSubProcess() *throws* Exception {
KnowledgeBase kbase = createKnowledgeBase("TR_SignalSubProcess.bpmn2");
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
ProcessInstance processInstance = ksession.startProcess("defaultPackage.TR_SignalSubProcessTest", buildParameters());
ksession.signalEvent("SignalProceed", *null*);
+assertTrue+(processInstance.getState() == ProcessInstance.+STATE_COMPLETED+);
}
Any help with this would be greatly appreciated,
Thanks - Tom
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/732699#732699]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months