0 Replies Latest reply on Oct 22, 2014 9:31 AM by Soumya Bose

    Jbpm 6.1.0.Final Issue with Receive Task.

    Soumya Bose Newbie

      I have two bpmn files. One having 'Send Message Task' that is throwing some message 'message1'. Another having 'Receive Message Task' where It is listening to the same message i.e 'message1'. In my Receive Task node I am assigning the message value to a process variable 'processVar1'.


      In my test case I am starting the receive task's process 1st, then starting send task's process. But the message was thrown is not catched by the ReceiveTaskHandler. I have seen the implementation of ReceiveTaskHandler. There we are only populating a map with messageId within executeWorkItem() method. We are not completing the workItem. I can see one method 'public void messageReceived(String messageId, Object message)' within ReceiveTaskHandler class where we are completing the workItem with the message value passed as a parameter. But while debugging can't see this method is getting called internally.


      Hence I have overriden the default 'ReceiveTaskHandler' and in that class within executeWorkItem() method If I complete the workItem with some hard coded message value then the receive task's process is getting completed and printing the 'processVar1' as the hard coded value I passed at the time of completing the workItem.


      Also I checked that the parameter maps of Receive task workItem is coming have only MessageId and MessageType..I am not getting the message value. So not sure how to get the message value at this point to complete the workItem, so that I will get back the message payload that was thrown from Send task's process.


      Upon further drill down I have seen, there is a method 'org.jbpm.workflow.instance.node.WorkItemNodeInstance.createWorkItem(WorkItemNode)' where we are populating the workItem's parameter map. here we are not populating the message value that was thrown from Send task's process.


      Please advise, If I am missing any particular step or is there any existing bug with that.


      Following is my test case -



          public void testSendReceiveTask() {

              RuntimeManager manager = createRuntimeManager("SendTaskTest.bpmn",


              RuntimeEngine engine = getRuntimeEngine(null);

              KieSession ksession = engine.getKieSession();


              KieRuntimeLogger log = KieServices.Factory.get().getLoggers()

                      .newThreadedFileLogger(ksession, "test", 1000);


              // start a new process instance

              Map<String, Object> params = new HashMap<String, Object>();


              ksession.startProcess("ReceiveTask", params);


              ksession.startProcess("SendTaskTest", params);


              TaskService taskService = engine.getTaskService();


              List<TaskSummary> taskSummaries = taskService

                      .getTasksAssignedAsPotentialOwner("krisv", "en-UK");


              TaskSummary taskSummary = taskSummaries.get(0);


              taskService.start(taskSummary.getId(), "krisv");


              taskService.complete(taskSummary.getId(), "krisv", params);







      Attaching my bpmn files if that helps.