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]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to