[jBPM] - jBPM5 - Using as a state machine in clustered spring application with a dashboard
by Narayan Singh
Narayan Singh [http://community.jboss.org/people/narayans] created the discussion
"jBPM5 - Using as a state machine in clustered spring application with a dashboard"
To view the discussion, visit: http://community.jboss.org/message/595120#595120
--------------------------------------------------------------
We're currently investigating to use BPM as a workflow/state machine for process orchestration in a very high volume clustered environment. Orchestration component is Spring application which sends and receives events from other component over MQ/REST and basically events decides process state transition.
Here are some basic requirements for the Orchestration component we have and so far my observations with jBPM5 -
1. Clustering and Server deployment - Multiple instances of orchestration component are deployed to the cluster, hence the process state is maintained across cluster and server instances can drop and join the cluster any time.
Observation: If I use drools-spring to boot-strap my jBPM5 engine then I got 2 options - a) create new session or b) load existing session. But to load existing session I need to specify session id. In other words, I would need to write custom code upfront to decide whether I want to create new session or load existing one based on some thing, and this code needs to be cluster-safe as multiple instances starting up at the same time.
So do you agree we cant use any out-of-the box solution here and one have to write custom boot-strap code?
2. Dashboard support - We have our own platform-wide Dashboard and we want to add process state information to it, ideally using REST interface provided by jBPM. So we're not using any of jBPM console apps provided out-of-the-box.
Observation: currently jBPM console functionality is consists of JBoss BPM modules(ex. org.jboss.bpm:gwt-console-server etc) hooked in with jBPM integration services as provided in jbpm-gwt-xxx modules. we cant use it out-of-the box because -
1/ some of the jbpm-gwt-xxx modules have got persistence.xml with hard-wired H2 database details
2/ they are tightly coupled with Human-task and Guvonor, however in our case we are bundling all our processes as part of the application and not using any WS-HT either. In other words state transition of our process is driven by the events.
So as I understand we would need to build our version of "org.jboss.bpm:gwt-console-server" bundled with custom services to expose REST api to be used by dashboard. Would Knowledge api be used to extract current state from the database or am I missing something here?
3. Persistence - As I understand there are 2 forms of it - runtime state and auditing. Auditing is mainly pluggable using various listeners, and there are some out-of the box audit loggers available. For Runtime state, which is core part of jBPM5, I only see 3 entities -
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
Observation: Runtime state is stored in binary form and there is no relationship between tables, so merely looking at tables not able to say which process part of which session. So one has to use knowledgeSession to extract the information.
I see loads of potential in jBPM5 and believe it could be used in our case. I would really appreciate any directions here to understand how it can solve our requirements as pointed out above?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/595120#595120]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 2 months
[jBPM] - How can I get a itemDefinition related to a process variable?
by Francesco Pietrobelli
Francesco Pietrobelli [http://community.jboss.org/people/francesco.pietrobelli] created the discussion
"How can I get a itemDefinition related to a process variable?"
To view the discussion, visit: http://community.jboss.org/message/620413#620413
--------------------------------------------------------------
Hi guys,
I would like to build forms for human activities in an automatic and dynamic fashion, but to do this I need to know the data type associated to every dataOutput of the tasks.
My first idea was to retrieve the data type of a process variable inside a WorkItemHandler in the following way:
public void executeWorkItem(WorkItem item, WorkItemManager manager) {
WorkflowProcessInstance currentProcess = (WorkflowProcessInstance) ksession.getProcessInstance(item.getProcessInstanceId());
HumanTaskNodeInstance currentNode = (HumanTaskNodeInstance) findNodeInstance(item.getId(), currentProcess);
Map<String, String> outMappings = ht.getHumanTaskNode().getOutMappings();
for (String outParameterName : outMappings.keySet()) {
System.out.println("Type of process variable: "+currentProcess.getVariable(outMappings.get(outParameterName)).getClass());
}
}
private WorkItemNodeInstance findNodeInstance(long workItemId,NodeInstanceContainer container) {
for (NodeInstance nodeInstance : container.getNodeInstances()) {
if (nodeInstance instanceof WorkItemNodeInstance) {
WorkItemNodeInstance workItemNodeInstance = (WorkItemNodeInstance) nodeInstance;
if (workItemNodeInstance.getWorkItem().getId() == workItemId) {
return workItemNodeInstance;
}
}
if (nodeInstance instanceof NodeInstanceContainer) {
WorkItemNodeInstance result = findNodeInstance(workItemId,((NodeInstanceContainer) nodeInstance));
if (result != null) {
return result;
}
}
}
return null;
}
But in many case outMappings.get(outParameterName) returns null because process variable wasn't set before and so and i can't invoke getClass() on it.
Does any one have any suggestion? is possible to do this programmatically via API?
Francesco.
P.S: I'am using jBPM 5.1Final
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620413#620413]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 2 months
[jBPM] - Incorrect Gateway diverge and converge operations in jBPM 5
by shashi mhatre
shashi mhatre [http://community.jboss.org/people/khalipili] created the discussion
"Incorrect Gateway diverge and converge operations in jBPM 5"
To view the discussion, visit: http://community.jboss.org/message/581930#581930
--------------------------------------------------------------
I am using below sample flow in my test. it contains three human task. once the process process is started it execute successfully till human task creation. As the first gateway diverge is of type "AND" it creates two task as shown below. I can view these task in jbpm-console. now once i login as user "Shashi" and complete the first task, As the next gateway converge is of type "XOR", the flow proceeds further and create the next task for user "Shashi".
As process have proceed further till gateway converge, jbpm should have remove the task for user "kris". but jbpm still shows the task for user "kris".
this seems to be a error in jbpm process execution.
next once user "shashi" completes the human task, process execution completes but throws below error. it seems that human task handler tries to abort the "kris" task which should have be aborted prior (at gateway converge).
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
java.lang.IllegalArgumentException: attempt to create merge event with null entity
at org.hibernate.event.MergeEvent.<init>(MergeEvent.java:60)
at org.hibernate.event.MergeEvent.<init>(MergeEvent.java:43)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:688)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:692)
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:235)
at org.drools.persistence.processinstance.JPAWorkItemManager.abortWorkItem(JPAWorkItemManager.java:124)
at org.drools.command.runtime.process.AbortWorkItemCommand.execute(AbortWorkItemCommand.java:56)
at org.drools.command.runtime.process.AbortWorkItemCommand.execute(AbortWorkItemCommand.java:29)
at org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:274)
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.abortWorkItem(CommandBasedStatefulKnowledgeSession.java:149)
at com.sample.util.CommandBasedWSHumanTaskHandler$GetCompletedTaskResponseHandler.execute(CommandBasedWSHumanTaskHandler.java:257)
at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:81)
at org.jbpm.task.service.mina.MinaTaskClientHandler.messageReceived(MinaTaskClientHandler.java:47)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)
at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:229)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)
at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
[2011:01:19 17:01:78:exception] Uncaught exception on client
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
. http://community.jboss.org/servlet/JiveServlet/showImage/2-581930-11171/S... http://community.jboss.org/servlet/JiveServlet/downloadImage/2-581930-111...
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/581930#581930]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 2 months