Jim B [
https://community.jboss.org/people/jamesbeam] created the discussion
"Pass ksession to custom WorkItemHandler running in jBPM Console?"
To view the discussion, visit:
https://community.jboss.org/message/806601#806601
--------------------------------------------------------------
I have a custom WorkItemHandler in which I am looking up all of the processes in the
current session (and possibly starting new processes) e.g.:
ksession.getProcessInstanceId() and ksession.startProcess(procName) respectively.
Initially, I passed in the ksession using the custom constructor for my WorkItemHandler
that accepted a ksession value. Everything was great UNTIL I went to run the process
inside of jBPM Console and realized that I don't have a way to call that constructor
when I start the process from the Console.
As an alternative, I thought I would just insert the session into a variable in a script
task and then pass that into my WorkItemHandler, but for the life of me I can't figure
out how to get it working. I set up a process variable
org.drools.runtime.StatefulKnowledgeSession and then set it in my script task with
kcontext.getKnowledgeRuntime(). I see that I'm getting an
org.drools.impl.StatefulKnowledgeSessionImpl and I am able to call
kcontext.setVariable("ksession",myKnowlegeRuntime). However, I am using
persistence and when I try to pass the variable into my WorkItemHandler (I successfully
pass a few other variables) get an "IOException while storing..." I assume
because it isn't serializable?
Can someone tell me how to inject (or obtain) the ksession in the WorkItemHandler WITHOUT
relying on the custom constructor with ksession?
Alternatively, does anyone know how to pass a parameter (specifically, the ksession) to my
workitemhandler running in the Console e.g. using the CustomWorkItemHandlers.conf?
Thanks for any insight!
-J
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/806601#806601]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]