[jBPM] - Pass the result of a workitem to the next workitem with a workitemhandler
by hansi007
hansi007 [https://community.jboss.org/people/hansi007] created the discussion
"Pass the result of a workitem to the next workitem with a workitemhandler"
To view the discussion, visit: https://community.jboss.org/message/738803#738803
--------------------------------------------------------------
Is it possible to pass the results of a workitem to the next workitem with a workitemhandler:
public class MyHandlerWorkItemTypeA implements WorkItemHandler{
@Override
public final void executeWorkItem(WorkItem wItem, WorkItemManager wItemManager) {
Map<String,Object> objectToPassToTheNextWorkItem = ...
wItemManager.completeWorkItem(wItem.getId(), objectToPassToTheNextWorkItem ); //That doesnt work
}
@Override
public final void abortWorkItem(WorkItem wItem, WorkItemManager wItemManager) {
}
}
public class MyHandlerWorkItemTypeB implements WorkItemHandler{
@Override
public final void executeWorkItem(WorkItem wItem, WorkItemManager wItemManager) {
Map<String,Object> objectToGetFromThePreviousWorkItem = wItem.getResults(); //That doesnt work
}
@Override
public final void abortWorkItem(WorkItem wItem, WorkItemManager wItemManager) {
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/738803#738803]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years
[jBPM] - Re: Session and thread safety
by Sebastian Calbaza
Sebastian Calbaza [https://community.jboss.org/people/calbazasebastian] created the discussion
"Re: Session and thread safety"
To view the discussion, visit: https://community.jboss.org/message/760010#760010
--------------------------------------------------------------
Here is my thread safe ProcessPersistenceContextManager if someone needs it.
It needs to be set on the Environment param (env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, persistenceContextManager);) before you pass it to JPAKnowledgeService.newStatefulKnowledgeSession(kbase,null, env)
-----------------------------------------
public class MyJpaProcessPersistenceContextManager implements
ProcessPersistenceContextManager, PersistenceContextManager {
private EntityManagerFactory emf;
private ThreadLocal<EntityManager> appScopedEntityManager=new ThreadLocal<EntityManager>();
protected ThreadLocal<EntityManager> cmdScopedEntityManager=new ThreadLocal<EntityManager>();
public ProcessPersistenceContext getProcessPersistenceContext() {
return new JpaProcessPersistenceContext(cmdScopedEntityManager.get());
}
public MyJpaProcessPersistenceContextManager(Environment env) {
this.emf = (EntityManagerFactory) env.get(EnvironmentName.ENTITY_MANAGER_FACTORY);
}
public PersistenceContext getApplicationScopedPersistenceContext() {
if (this.appScopedEntityManager.get() == null) {
this.appScopedEntityManager.set(this.emf.createEntityManager());
}
return new JpaPersistenceContext(appScopedEntityManager.get());
}
public PersistenceContext getCommandScopedPersistenceContext() {
return new JpaPersistenceContext(this.cmdScopedEntityManager.get());
}
public void beginCommandScopedEntityManager() {
if (cmdScopedEntityManager.get() == null ||
(this.cmdScopedEntityManager.get() != null && !this.cmdScopedEntityManager.get().isOpen())) {
this.cmdScopedEntityManager.set( this.emf.createEntityManager());
}
cmdScopedEntityManager.get().joinTransaction();
appScopedEntityManager.get().joinTransaction();
}
public void endCommandScopedEntityManager() {
if (this.cmdScopedEntityManager.get()!=null){
this.cmdScopedEntityManager.get().flush();
this.cmdScopedEntityManager.get().close();
}
}
public ThreadLocal<EntityManager> getCmdScopedEntityManager() {
return cmdScopedEntityManager;
}
public ThreadLocal<EntityManager> getAppScopedEntityManager() {
return appScopedEntityManager;
}
public void dispose() {
if (this.appScopedEntityManager.get() != null && this.appScopedEntityManager.get().isOpen()) {
this.appScopedEntityManager.get().flush();
this.appScopedEntityManager.get().close();
}
this.appScopedEntityManager.set(null);
if (this.cmdScopedEntityManager.get() != null && this.cmdScopedEntityManager.get().isOpen()) {
this.cmdScopedEntityManager.get().flush();
this.cmdScopedEntityManager.get().close();
}
this.cmdScopedEntityManager.set(null);
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/760010#760010]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years
[JBoss Tools] - JBoss 4.1.0.Alpha1 memory leak?
by Jesper Skov
Jesper Skov [https://community.jboss.org/people/jskovjyskebankdk] created the discussion
"JBoss 4.1.0.Alpha1 memory leak?"
To view the discussion, visit: https://community.jboss.org/message/804026#804026
--------------------------------------------------------------
A few of us has started using the new Alpha1 with Kepler M5.
The impression is there is a much higher memory load. Especially on XP where our Heap is limited to 1GB this becomes a problem.
Since I don't have a specific use case I can repeat, I have a little trouble providing you with some useful information.
However, I got a heap dump from one of the sessions where things was at a crawl. Analyzing it, I find this in Memory Analysis's leak suspects:
900 instances of *"org.jboss.tools.common.model.filesystems.impl.JarAccess"*, loaded by *"org.jboss.tools.common.model"* occupy *68.321.856 (18,11%)* bytes.
These instances are referenced from one instance of *"org.eclipse.jdt.core.IElementChangedListener[]"*, loaded by *"org.eclipse.jdt.core"*
20% of memory locked up by a single plugin seems excessive, but I don't really have anything to compare it with. So it may be OK?!?
What do you think?
Is there something I can provide you to resolve if this is a JBossTools leak?
Cheers,
Jesper
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/804026#804026]
Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years
[jBPM] - Re: jBPM5 - Can't Scale, Won't Scale
by Kris Verlaenen
Kris Verlaenen [https://community.jboss.org/people/KrisVerlaenen] created the discussion
"Re: jBPM5 - Can't Scale, Won't Scale"
To view the discussion, visit: https://community.jboss.org/message/801981#801981
--------------------------------------------------------------
> > *If you only have one session, there would be no contention as the ksession would solve this*
> I did not know this and this is could be the root of my misunderstanding. But I can't understand how the ksession could solve this. If process instance A executes in transaction Ta and process instance B executes in transaction Tb, and both transactions change the session info - which is simply a JPA entity - how do the two process instance executions NOT serialise?
The engine will make sure request a is completed before starting request b.
> In fact, I can see how these sessions might be useful for Drools users, but from the point-of-view of a jBPM user - who just wants to execute processes - it's hard to see what the concept of sessions gives you? If you just want to execute business processes, why should you care about "sessions"?
A session is the runtime interface to talk to the engine, so you do need it. But you are right, when you don't need any rule-related persistence etc., you probably don't need some of this "advanced" session management. In situations like this, the two most common architectures are:
* Session per request: if your session doesn't contain any state and you don't use any timers, you can just instantiate a session on request and dispose it afterwards
-> session mgmt is fairly simple, just create / dispose every time
* Singleton session (or as extension N sessions): you have a service that reuses the same session(s), and keeps these sessions alive at all time (to support timer execution), possibly distributed across a cluster of nodes
-> no disposal of sessions
Kris
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/801981#801981]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years
[jBPM] - BPM5Processor - JBossESB
by Vu Kien Pham
Vu Kien Pham [https://community.jboss.org/people/vukien] created the discussion
"BPM5Processor - JBossESB"
To view the discussion, visit: https://community.jboss.org/message/751974#751974
--------------------------------------------------------------
Dear Community,
I've successfully deployed a process on JBPM console. This process consists of different Task forms, Java and JBossESB work items (imported from public Service Repository)
It would be ok if I only have to trigger it in console.
But now I've got problem regarding triggering this process externally.
My question is if it is possible to trigger this process by using BPM5Processor from JBossESB and how? The idea is that a message is sent to ESB to trigger this JBPM process
As I read in the Service Guide, ESB can start a process that has been deployed to jBPM but all I can do is to start a simple process with script tasks within Eclipse. I got no idea how to make the BPM5Processor aware of a already deployed process.
Would appreciate if anyone can give me some suggestions.
I'm using:
JBPM 5.2
JBoss 5.1.0 GA
JBoss ESB 4.11
Java 7
Thanks!
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/751974#751974]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years