2 Replies Latest reply on May 3, 2011 9:10 PM by jdh

    jBPM 5.0 ProcessContext creation

    jdh

      Michael Wohlfart gave me some good advise to upgrade my project to jBPM 5.0.0 and I am trying to do so.  I have the install configured, but the user guide has some holes in it.  I was reading through the online version at http://docs.jboss.org/jbpm/v5.0/userguide/ch03.html.  In 3.2 it discusses how to create a KnowledgeBuilder, a KnowledgeBase and a StatefulKnowledgeSession.  Then it jumps to using a ProcessContext called kcontext.  There is no instruction on how to create a kcontext.  It is referenced several times in chapter 3.  How do I create one of these?

       

      I am trying to take an external message that was received by my application and pass the object to the current state in the process.  I already know which process the message is for and have the process instance.  In jBPM 4.4 I used to do something like this:

       

      execution = getProcessInstance().findActiveExecutionIn(activityName);

      exectuionId = exectuion.getId();

      Map Parameters.put("message", msg);

      processInstance.signalExectuionById(executionId, "Message", parameters);

       

      What is the best way to accomplish the same thing with 5.0?  I assumed this would use the kcontext to get the current node kcontext.getNodeInstance().  Then use that to signal the current state and pass the message to it as I did before.  Can anyone point me to either documentation on this or an example.  Thanks!


      Jim

        • 1. jBPM 5.0 ProcessContext creation
          zorin

          You do not need to get to a context, there are two signal methods in StatefulKnowledgeSession.

          One method passes event to all processes run by this session, another one passes event to a specific instance given its id:

          ksession.signalEvent(signalName, data, instance.getWorkflowInstanceId());

          • 2. jBPM 5.0 ProcessContext creation
            jdh

            Thanks Victor, I didn't get that from the user guide.  This seems easier than what we used to have to do.  I'll give it a try first thing tomorrow.

             

            Jim