[jBPM] - user task or script task ?
by joachyt
joachyt [http://community.jboss.org/people/joachyt] created the discussion
"user task or script task ?"
To view the discussion, visit: http://community.jboss.org/message/625146#625146
--------------------------------------------------------------
hi ,
I am new to workflow. Appreciate any pointers on this design question.
1. is it normal or best practice to design workflows such that they can be run with UI input supplementing the data and also the workflow can be run as a batch job with data supplied to the workflow by non UI means ?
If so, should I have script tasks which will undertake UI handling when run in the UI context and pull the data by some other means [xml, db etc] when run in batch mode ?
In general when you design a workflow, is it the case that you almost always know at design time whether you are going to have certain action hnalded by user or some other script ?
2. In my problem, I have some backend java objects that do the actual work. I need to call a specific method on them as part of my workflow actions. When I use "script task" and java as the script option, the designer takes the java code snippet. can I do something like this :
Service service = ServiceLocator.getService("some identifier");
// access some state data from the workflow
service.invoke("data retrieved from workflow");
Is this the correct usage ?
Is there a standard interface that jbpm would recognise that my service objects can implement , thereby , my service objects are first class workflow handlers.
appreciate any help.
thanks
Joe
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625146#625146]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[jBPM] - jBPM issue using Persistence and fireUntilHalt
by Abhishek Chavan
Abhishek Chavan [http://community.jboss.org/people/bezudar] created the discussion
"jBPM issue using Persistence and fireUntilHalt"
To view the discussion, visit: http://community.jboss.org/message/625191#625191
--------------------------------------------------------------
Hi,
I am trying to use the jBPM example for persisting the data and trying to use another thread for rule processing using
ksession.fireUntilHalt();
but I am encountering the following exception.
Exception in thread "Thread-4" org.drools.RuntimeDroolsException: Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalAction@1be20c
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:996)
at org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1037)
at org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:777)
at org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:753)
at org.drools.command.runtime.rule.FireUntilHaltCommand$1.run(FireUntilHaltCommand.java:50)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:43)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:106)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:186)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150)
at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)
at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:162)
at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:143)
at org.jbpm.workflow.instance.node.RuleSetNodeInstance.signalEvent(RuleSetNodeInstance.java:73)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:339)
at org.jbpm.process.instance.event.DefaultSignalManager.internalSignalEvent(DefaultSignalManager.java:80)
at org.jbpm.process.instance.event.DefaultSignalManager$SignalAction.execute(DefaultSignalManager.java:175)
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:994)
... 5 more
The same is working fine without persistence and another test is running fine with persistence but there i am calling
kession.fireAllRules();
explicitly. I have made my model classes serializable.
The code used is :
public void reactiveProcessAndRulesTest() throws InterruptedException {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder();
kbuilder.add(new ClassPathResource("EmergencyServiceSimple.bpmn"),
ResourceType.BPMN2);
kbuilder.add(new ClassPathResource("SelectEmergencyVehicleSimple.drl"),
ResourceType.DRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error : errors) {
System.out.println(error.getMessage());
}
return;
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
EntityManagerFactory emf = Persistence
.createEntityManagerFactory("org.jbpm.task");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
final StatefulKnowledgeSession ksession = JPAKnowledgeService
.newStatefulKnowledgeSession(kbase, null, env);
// ksession = kbase.newStatefulKnowledgeSession();
// Setting the process engine and the rule engine in reactive mode
// This will cause that if a rule is activated, the rule will fire
// without waiting
// the user to call the fireAllRules() method.
MyHumanChangingValuesSimulatorWorkItemHandler humanActivitiesSimHandler = new MyHumanChangingValuesSimulatorWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task",
humanActivitiesSimHandler);
KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
Emergency emergency = new Emergency("555-1234");
// Run with Heart Attack and check the output. An Ambulance must appear
// in the report
// emergency.setType("Heart Attack");
// Run with Fire and check the output. A FireTruck must appear in the
// report
emergency.setType("Fire");
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("emergency", emergency);
WorkflowProcessInstance process = (WorkflowProcessInstance) ksession
.startProcess(
"com.wordpress.salaboy.bpmn2.SimpleEmergencyService",
parameters);
// My Emergency and My Process are both inserted as Facts / Truths in my
// Knowledge Session
// Now Emergency and the Process Instance can be used by the inference
// engine
ksession.insert(emergency);
ksession.insert(process);
new Thread(new Runnable() {
public void run() {
ksession.fireUntilHalt();
}
}).start();
// Is the Process still Active?
Assert.assertEquals(ProcessInstance.STATE_ACTIVE, process.getState());
// Is there a running node instance?
Assert.assertEquals(1, process.getNodeInstances().size());
// Is the process stopped in the "Ask for Emergency Information"
// activity?
Assert.assertEquals("Ask for Emergency Information", process
.getNodeInstances().iterator().next().getNodeName());
// Lets check the value of the emergency.getRevision(), it should be 1
Assert.assertEquals(1,
((Emergency) process.getVariable("emergency")).getRevision());
System.out.println("Completing the first Activity");
// Complete the first human activity
humanActivitiesSimHandler.completeWorkItem();
// I need to sleep for a little while, because the other thread can be
// executing some activated rules
Thread.sleep(1000);
// Lets check the value of the vehicle variable it should be a Fire
// Truck => Fire
Assert.assertTrue(((Vehicle) process.getVariable("vehicle")) instanceof FireTruck);
// Is the Process still Active?
Assert.assertEquals(ProcessInstance.STATE_ACTIVE, process.getState());
// Is there a running node instance?
Assert.assertEquals(1, process.getNodeInstances().size());
// Is the process stopped in the "Dispatch Vehicle" activity?
Assert.assertEquals("Dispatch Vehicle", process.getNodeInstances()
.iterator().next().getNodeName());
// Lets check the value of the emergency.getRevision(), it should be 2
Assert.assertEquals(2,
((Emergency) process.getVariable("emergency")).getRevision());
System.out.println("Completing the second Activity");
// Complete the second human activity
humanActivitiesSimHandler.completeWorkItem();
// Is the process completed?
Assert.assertEquals(ProcessInstance.STATE_COMPLETED, process.getState());
}
My Full code is in this thread : http://community.jboss.org/message/625081#625081 http://community.jboss.org/message/625081
Any help would be appreciated.
I also see very wierd behaviour happening when running the program in Debug mode in eclipse and run mode.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625191#625191]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[EJB3] - Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
by Garry Dias
Garry Dias [http://community.jboss.org/people/garrydias] created the discussion
"Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1"
To view the discussion, visit: http://community.jboss.org/message/625136#625136
--------------------------------------------------------------
Hello .. I have a similar issue but in jboss 5.1 using ejb 3.0
My clustered app process thousands requests but I have problems in only one node.
My bean is annotated with StrictMaxPool=100 without strictTimeout. Sometimes the max pool size is reached and the incoming requests (new bean instances creation in the pool) are blocked with *Failed to acquire the pool semaphore, strictTimeout=-1*. Until now it´s an application regular behavior.
When beans creation requests decreases my ejb blocks new instances creation =/ and *Failed to acquire the pool semaphore, strictTimeout=-1* occurs all the time. It´s like the pool is still full but in JMX-CONSOLE (domain j2ee, service=EJB3) and accessing MyWorkerBean link, the AvailableCount attribute is always 0 (until in other clustered node this attribute increases and decreases normally) and worse: no bean is instantiated anymore. My pool is empty but the container can´t instatiate MyWorkerBeans anymore. Why??? It´s affecting my business.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625136#625136]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[JBoss Tools] - JBoss Tools never finishes discovering an already-installed GateIn runtime
by David Lambert
David Lambert [http://community.jboss.org/people/davidl2] created the discussion
"JBoss Tools never finishes discovering an already-installed GateIn runtime"
To view the discussion, visit: http://community.jboss.org/message/625112#625112
--------------------------------------------------------------
I've installed JBoss Tools into Rational Application Developer 8.0.3 (based on Eclipse 3.6). I also unpacked the GateIn 3.10 distribution elsewhere in the filesystem. I want to import a portal-development project that uses GateIn. Since i don't already have a "server" in Eclipse for that JBoss AS instance, when I open the project for the first time, I get the "Workspace Migration" wizard, and it gives me a link to "search for server runtimes". When I do so, I'm able to browse to the JBoss GateIn instances (at C:\Cygwin\opt\GateIn-3.1.0-GA). It correctly identifies the server as JBoss 5.1. However, whn I click "Next", it grays out the screen and never does anything else. It gives the message
"The user operation is waiting for background work to complete"
I can hit the "stop" icon (red square) to cancel out, but in that case no "server" actually gets created.
Is this the right way to associate an already-installed JBoss server with an instance of Eclipse that has JBoss Tools installed?
--
DLL
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625112#625112]
Start a new discussion in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months