[jboss-user] [jBPM] - Re: StatefulKnowledgeSession in custom work item handlers
Amin Mohammed-Coleman
do-not-reply at jboss.com
Sat Nov 12 10:47:32 EST 2011
Amin Mohammed-Coleman [http://community.jboss.org/people/amin-mc] created the discussion
"Re: StatefulKnowledgeSession in custom work item handlers"
To view the discussion, visit: http://community.jboss.org/message/636283#636283
--------------------------------------------------------------
Just looking at the source code...could i extend the JPAWorkItemManager to achive this? For example:
in JPAWorkItemManager
public void internalExecuteWorkItem(WorkItem workItem) {
Environment env = this.kruntime.getEnvironment();
WorkItemInfo workItemInfo = new WorkItemInfo(workItem, env);
PersistenceContext context = ((PersistenceContextManager) env.get( EnvironmentName.PERSISTENCE_CONTEXT_MANAGER )).getCommandScopedPersistenceContext();
context.persist( workItemInfo );
((WorkItemImpl) workItem).setId(workItemInfo.getId());
workItemInfo.update();
if (this.workItems == null) {
this.workItems = new HashMap<Long, WorkItemInfo>();
}
workItems.put(workItem.getId(), workItemInfo);
WorkItemHandler handler = (WorkItemHandler) this.workItemHandlers.get(workItem.getName());
if (handler != null) {
if (handler instanceof StatefulKnowledgeSessionAware) {
//invoke a different execute and inject the session into this?
handler.executeWorkItemWithSession(workItem, this, kruntime);
} else {
handler.executeWorkItem(workItem, this);
}
} else {
throwWorkItemNotFoundException( workItem );
}
}
Would this work? If so would i register a custom JPAWorkItemManager other than creating my own version of this...
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/636283#636283]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111112/19527df8/attachment-0001.html
More information about the jboss-user
mailing list