cancel
Showing results for 
Search instead for 
Did you mean: 

Assign two resources with the same task ID

marwahussein
Champ in-the-making
Champ in-the-making
i am trying to map some events using esper and Activiti, my main goal at this time is to assign two resources to the same task
I created a class containingg all neccesary Information I need and I throw it to esper stream and from the main function I created a hash map and populate it with information to be sent to the stream. when I am trying to assign a resource it didn't respond until I add it to the hash map
this is the example I wrote

Map<String, Object> processVariables = new HashMap<String, Object>();
      processVariables.put("loanAmount", 10);
                processVariables.put("resource", "John");

      ProcessInstance pi = runtimeService.startProcessInstanceByKey("loanrequest_withespertest", processVariables);
      System.out.println("Process isntance id is "+pi.getId());
      Thread.sleep(1000);

      // Evaluate first loan request
      processVariables.put("requestApproved", true);
                taskService.createTaskQuery().taskAssignee("John");//.singleResult(); // create and assign command
                taskService.createTaskQuery().taskAssignee("Atef");//.singleResult();
                taskService.setAssignee("11", "Atef");
      taskService.complete(taskService.createTaskQuery().singleResult().getId(), processVariables);


and here is the result:

>>> Throwing event: task  create  successfully: LoanRequestReceivedEvent{taskInstanceId= 11,receiveTime= 1443939476670,requestedAmount= 10,eventtype= create,resource= John}
event mapped successfully:  {receiveTime=1443939476670, requestedAmount=10, taskInstanceId=11, eventType=created}
Process isntance id is 4
>>> Throwing event: task  assignment  successfully: LoanRequestReceivedEvent{taskInstanceId= 11,receiveTime= 1443939477756,requestedAmount= 10,eventtype= assignment,resource= John}
event mapped successfully:  {receiveTime=1443939477756, requestedAmount=10, taskInstanceId=11, eventType=allocated}
>>> Throwing event: task  complete  successfully: LoanRequestReceivedEvent{taskInstanceId= 11,receiveTime= 1443939477896,requestedAmount= 10,eventtype= complete,resource= John}
event mapped successfully:  {receiveTime=1443939477896, requestedAmount=10, taskInstanceId=11, eventType=completed}

I need to know the difference between setAssignee and task assignee and how to detect that two resources are assigned to the same task
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
You could look at http://activiti.org/userguide/index.html#eventDispatcher, which is a lower-level mechanism to get this kind of data.