1 2 Previous Next 17 Replies Latest reply on Mar 13, 2011 7:28 AM by Odelya Holiday

    only the first human task is being saved in db!

    Odelya Holiday Novice

      Hi!

       

      I have in my process 2 human tasks.

       

      I handle my tasks with CommandBasedWSHumanTaskHandler.

       

      After this line:

       

      client.addTask(task, content, null);
      

       

      It should save the task to db.

       

      I see that only the first task is saved to DB, and when the code reaches the second human task - after this line it does not save to DB!

       

      Can BPMN support more than one human task?

        • 1. only the first human task is being saved in db!
          Mauricio Salatino Master

          Yes, it supports multiple human tasks in the same process.

          Can you share an isolated test that shows the behavior that you have?

          Are you sure that the task server is still alive and is not started again generating a new database for each interaction?

          Did you check the db configurations to be sure that it's not being erased each time that you run your app?

          Greetings.

          • 2. only the first human task is being saved in db!
            Odelya Holiday Novice

            It's a web application.

            The db is not being erased  - I can see the first taks in db.

             

            How can I make sure that the task server is not started again?

             

            When the server is up for the first time - I start the task server in the same thread as the application like this

             

             

            server = new MinaTaskServer(taskService);

            server.start();

             

            • 3. only the first human task is being saved in db!
              Mauricio Salatino Master

              Can you share with us the complete output log?

              Are you using the knowledgesession logger? to see if the process reaches the second task and what nodes are executed.

              Greetings

              • 4. Re: only the first human task is being saved in db!
                Odelya Holiday Novice

                I don't use the knowledgesession  however I am debuggin the application and see that it reaches the nodes and also my HumanTask in execute method.

                However, the first task is being saved after client.addTask(task, content, null); but not the second one.

                 

                Here is my log:

                 

                Hibernate: select hibernate_sequence.nextval from dual

                starting

                starting set process variables

                Hibernate: select hibernate_sequence.nextval from dual

                Hibernate: select hibernate_sequence.nextval from dual

                [2011:03:68 17:03:325:debug] Message receieved on server : RegisterForEventRequest

                [2011:03:68 17:03:328:debug] Arguments : [org.jbpm.task.event.TaskEventKey@3cd7f083, false, com.sintecmedia.handler.OnMediaHumanTaskHandler]

                [2011:03:68 17:03:430:debug] Message receieved on server : RegisterForEventRequest

                [2011:03:68 17:03:430:debug] Arguments : [org.jbpm.task.event.TaskEventKey@146b59f2, false, com.sintecmedia.handler.OnMediaHumanTaskHandler]

                [2011:03:68 17:03:430:debug] Message receieved on server : RegisterForEventRequest

                [2011:03:68 17:03:431:debug] Arguments : [org.jbpm.task.event.TaskEventKey@322e53d3, false, com.sintecmedia.handler.OnMediaHumanTaskHandler]

                [2011:03:68 17:03:660:debug] Message receieved on server : AddTaskRequest

                [2011:03:68 17:03:660:debug] Arguments : [org.jbpm.task.Task@eee9b863, null]

                [2011:03:68 17:03:928:debug] Message receieved on client : AddTaskResponse

                [2011:03:68 17:03:928:debug] Arguments : [569]

                [2011:03:68 17:03:05:debug] Message receieved on server : QueryTaskByWorkItemId

                [2011:03:68 17:03:05:debug] Arguments : [568]

                [2011:03:68 17:03:304:debug] Message receieved on client : QueryTaskByWorkItemIdResponse

                [2011:03:68 17:03:304:debug] Arguments : [org.jbpm.task.Task@b70d6c70]

                [2011:03:68 17:03:371:debug] Message receieved on server : OperationRequest

                [2011:03:68 17:03:371:debug] Arguments : [Start, 569, ONAIR]

                [2011:03:68 17:03:372:debug] Command receieved on server was operation of type: Start

                [2011:03:68 17:03:650:debug] Message receieved on server : OperationRequest

                [2011:03:68 17:03:650:debug] Arguments : [Complete, 569, ONAIR, null, null]

                [2011:03:68 17:03:650:debug] Command receieved on server was operation of type: Complete

                MessagingTaskEventListener.taskCompleted 569

                Found generic listeners: 1

                [2011:03:68 17:03:678:debug] Message receieved on client : EventTriggerResponse

                [2011:03:68 17:03:678:debug] Arguments : [org.jbpm.task.event.EventPayload@bbfed9]

                [2011:03:68 17:03:704:debug] Message receieved on client : OperationResponse

                [2011:03:68 17:03:704:debug] Arguments : []

                [2011:03:68 17:03:704:debug] Message receieved on client : OperationResponse

                [2011:03:68 17:03:704:debug] Arguments : []

                [2011:03:68 17:03:721:debug] Message receieved on server : GetTaskRequest

                [2011:03:68 17:03:721:debug] Arguments : [569]

                [2011:03:68 17:03:794:debug] Message receieved on client : GetTaskResponse

                [2011:03:68 17:03:794:debug] Arguments : [org.jbpm.task.Task@47e46d99]

                Notification of completed task 568

                This action between human task 1 to human task 2

                Hibernate: select hibernate_sequence.nextval from dual

                 

                In my action between the first human task to the second one I only print This action between human task 1 to human task 2 to show that it reaches there.

                 

                I debug, and see that it reaches the second task but after

                client.addTask(task, content, null) it doesn't save to db like the first one.

                • 5. Re: only the first human task is being saved in db!
                  Mauricio Salatino Master

                  can you try using the knowledge logger? because with the information that you share with us could be multiple problems.

                  If we don't have more visibility is impossible for us to help.

                  Greetings.

                  • 6. Re: only the first human task is being saved in db!
                    Odelya Holiday Novice

                    My case is like this:

                     

                    I start process which retrieve collection of data.

                     

                    For each data it runs a process.

                     

                    Each process has human task, then 2 scripts tasks and then another human task.

                     

                    The user completes the first task, the the other two should be executed, then it should reach the 2nd human task.

                     

                    However, it reaches it (I debug the CommandBasedWSHumanTaskHandler execute) method but does not save it to db!

                     

                    (the log is only until the line after client.addTask(task, content, null))

                     

                    The Begin lookup task is not being saved in DB!

                     

                    Hibernate: select hibernate_sequence.nextval from dual

                    BEFORE RULEFLOW VARIABLE CHANGED mediaList=[] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW VARIABLE CHANGED mediaList=[] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    BEFORE RULEFLOW VARIABLE CHANGED requestData=com.mycompany.process.mediaacq.data.RequestData@fe1a1f process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW VARIABLE CHANGED requestData=com.mycompany.process.mediaacq.data.RequestData@fe1a1f process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    BEFORE RULEFLOW STARTED process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    BEFORE RULEFLOW NODE TRIGGERED node:StartProcess[id=1] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    BEFORE RULEFLOW NODE TRIGGERED node:Find Material[id=8] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    starting

                    com.mycompany.process.mediaacq.data.RequestData@fe1a1f

                    BEFORE RULEFLOW VARIABLE CHANGED mediaList=[com.mycompany.process.mediaacq.data.MaterialData@c0bef2, com.mycompany.process.mediaacq.data.MaterialData@38293c] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW VARIABLE CHANGED mediaList=[com.mycompany.process.mediaacq.data.MaterialData@c0bef2, com.mycompany.process.mediaacq.data.MaterialData@38293c] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    BEFORE RULEFLOW NODE TRIGGERED node:Gateway[id=6] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    BEFORE RULEFLOW NODE TRIGGERED node:Set process variables[id=9] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    starting set process variables

                    BEFORE RULEFLOW VARIABLE CHANGED processInfo=com.mycompany.process.mediaacq.data.ProcessInfo@50cb21 process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW VARIABLE CHANGED processInfo=com.mycompany.process.mediaacq.data.ProcessInfo@50cb21 process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    BEFORE RULEFLOW NODE TRIGGERED node:Start process for material[id=10] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    Hibernate: select hibernate_sequence.nextval from dual

                    BEFORE RULEFLOW VARIABLE CHANGED materialData=com.mycompany.process.mediaacq.data.MaterialData@c0bef2 process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    AFTER RULEFLOW VARIABLE CHANGED materialData=com.mycompany.process.mediaacq.data.MaterialData@c0bef2 process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW VARIABLE CHANGED processInfo=com.mycompany.process.mediaacq.data.ProcessInfo@50cb21 process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    AFTER RULEFLOW VARIABLE CHANGED processInfo=com.mycompany.process.mediaacq.data.ProcessInfo@50cb21 process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW STARTED process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW NODE TRIGGERED node:StartProcess[id=1] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW NODE TRIGGERED node:File or Tape[id=2] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW NODE TRIGGERED node:Wait for material[id=3] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    Hibernate: select hibernate_sequence.nextval from dual

                    [2011:03:68 18:03:509:debug] Message receieved on server : RegisterForEventRequest

                    [2011:03:68 18:03:561:debug] Arguments : [org.jbpm.task.event.TaskEventKey@5af5753, false, com.mycompany.handler.OnMediaHumanTaskHandler]

                    [2011:03:68 18:03:716:debug] Message receieved on server : RegisterForEventRequest

                    [2011:03:68 18:03:717:debug] Arguments : [org.jbpm.task.event.TaskEventKey@1b5b41c7, false, com.mycompany.handler.OnMediaHumanTaskHandler]

                    [2011:03:68 18:03:717:debug] Message receieved on server : RegisterForEventRequest

                    [2011:03:68 18:03:717:debug] Arguments : [org.jbpm.task.event.TaskEventKey@1afe70a4, false, com.mycompany.handler.OnMediaHumanTaskHandler]

                    [2011:03:68 18:03:718:debug] Message receieved on server : AddTaskRequest

                    [2011:03:68 18:03:718:debug] Arguments : [org.jbpm.task.Task@b8f1bd26, null]

                    [2011:03:68 18:03:22:debug] Message receieved on client : AddTaskResponse

                    [2011:03:68 18:03:23:debug] Arguments : [598]

                    [2011:03:68 18:03:941:debug] Message receieved on server : QueryTaskByWorkItemId

                    [2011:03:68 18:03:941:debug] Arguments : [597]

                    [2011:03:68 18:03:139:debug] Message receieved on client : QueryTaskByWorkItemIdResponse

                    [2011:03:68 18:03:139:debug] Arguments : [org.jbpm.task.Task@11fcf57e]

                    AFTER RULEFLOW NODE TRIGGERED node:Wait for material[id=3] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    AFTER RULEFLOW NODE TRIGGERED node:File or Tape[id=2] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    AFTER RULEFLOW NODE TRIGGERED node:StartProcess[id=1] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    AFTER RULEFLOW STARTED process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    Hibernate: select hibernate_sequence.nextval from dual

                    BEFORE RULEFLOW VARIABLE CHANGED materialData=com.mycompany.process.mediaacq.data.MaterialData@38293c process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    AFTER RULEFLOW VARIABLE CHANGED materialData=com.mycompany.process.mediaacq.data.MaterialData@38293c process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW VARIABLE CHANGED processInfo=com.mycompany.process.mediaacq.data.ProcessInfo@50cb21 process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    AFTER RULEFLOW VARIABLE CHANGED processInfo=com.mycompany.process.mediaacq.data.ProcessInfo@50cb21 process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW STARTED process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW NODE TRIGGERED node:StartProcess[id=1] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW NODE TRIGGERED node:File or Tape[id=2] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW NODE TRIGGERED node:Wait for material[id=3] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    Hibernate: select hibernate_sequence.nextval from dual

                    [2011:03:68 18:03:343:debug] Message receieved on server : RegisterForEventRequest

                    [2011:03:68 18:03:343:debug] Arguments : [org.jbpm.task.event.TaskEventKey@5af5753, false, com.mycompany.handler.OnMediaHumanTaskHandler]

                    [2011:03:68 18:03:345:debug] Message receieved on server : RegisterForEventRequest

                    [2011:03:68 18:03:345:debug] Arguments : [org.jbpm.task.event.TaskEventKey@1b5b41c7, false, com.mycompany.handler.OnMediaHumanTaskHandler]

                    [2011:03:68 18:03:347:debug] Message receieved on server : RegisterForEventRequest

                    [2011:03:68 18:03:347:debug] Arguments : [org.jbpm.task.event.TaskEventKey@1afe70a4, false, com.mycompany.handler.OnMediaHumanTaskHandler]

                    [2011:03:68 18:03:351:debug] Message receieved on server : AddTaskRequest

                    [2011:03:68 18:03:351:debug] Arguments : [org.jbpm.task.Task@8a226e2, null]

                    [2011:03:68 18:03:375:debug] Message receieved on client : AddTaskResponse

                    [2011:03:68 18:03:375:debug] Arguments : [602]

                    [2011:03:68 18:03:99:debug] Message receieved on server : QueryTaskByWorkItemId

                    [2011:03:68 18:03:99:debug] Arguments : [601]

                    [2011:03:68 18:03:186:debug] Message receieved on client : QueryTaskByWorkItemIdResponse

                    [2011:03:68 18:03:186:debug] Arguments : [org.jbpm.task.Task@91ac959a]

                    AFTER RULEFLOW NODE TRIGGERED node:Wait for material[id=3] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    AFTER RULEFLOW NODE TRIGGERED node:File or Tape[id=2] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    AFTER RULEFLOW NODE TRIGGERED node:StartProcess[id=1] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    AFTER RULEFLOW STARTED process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    BEFORE RULEFLOW NODE TRIGGERED node:End[id=2] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    BEFORE RULEFLOW COMPLETED process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW COMPLETED process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    Hibernate: select processins0_.InstanceId as col_0_0_ from ProcessInstanceInfo processins0_ where ? in (select eventtypes1_.element from EventTypes eventtypes1_ where processins0_.InstanceId=eventtypes1_.InstanceId)

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW NODE TRIGGERED node:End[id=2] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW NODE TRIGGERED node:Start process for material[id=10] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW NODE TRIGGERED node:Set process variables[id=9] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW NODE TRIGGERED node:Gateway[id=6] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW NODE TRIGGERED node:Find Material[id=8] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW NODE TRIGGERED node:StartProcess[id=1] process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    AFTER RULEFLOW STARTED process:Media Acquiring[id=com.mycompany.MediaAcquiring]

                    [2011:03:68 18:03:889:debug] Message receieved on server : OperationRequest

                    [2011:03:68 18:03:890:debug] Arguments : [Start, 602, ONAIR]

                    [2011:03:68 18:03:890:debug] Command receieved on server was operation of type: Start

                    [2011:03:68 18:03:945:debug] Message receieved on server : OperationRequest

                    [2011:03:68 18:03:945:debug] Arguments : [Complete, 602, ONAIR, null, null]

                    [2011:03:68 18:03:945:debug] Command receieved on server was operation of type: Complete

                    MessagingTaskEventListener.taskCompleted 602

                    Found generic listeners: 2

                    [2011:03:68 18:03:981:debug] Message receieved on client : EventTriggerResponse

                    [2011:03:68 18:03:981:debug] Arguments : [org.jbpm.task.event.EventPayload@fcaad2]

                    [2011:03:68 18:03:02:debug] Message receieved on client : OperationResponse

                    [2011:03:68 18:03:02:debug] Arguments : []

                    [2011:03:68 18:03:02:debug] Message receieved on client : OperationResponse

                    [2011:03:68 18:03:02:debug] Arguments : []

                    [2011:03:68 18:03:06:debug] Message receieved on client : EventTriggerResponse

                    [2011:03:68 18:03:06:debug] Arguments : [org.jbpm.task.event.EventPayload@1bb11df]

                    [2011:03:68 18:03:07:debug] Message receieved on server : GetTaskRequest

                    [2011:03:68 18:03:08:debug] Arguments : [602]

                    [2011:03:68 18:03:51:debug] Message receieved on server : GetTaskRequest

                    [2011:03:68 18:03:51:debug] Arguments : [602]

                    [2011:03:68 18:03:87:debug] Message receieved on client : GetTaskResponse

                    [2011:03:68 18:03:87:debug] Arguments : [org.jbpm.task.Task@45e0814e]

                    Notification of completed task 601

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW NODE TRIGGERED node:Create kids media (tape)[id=4] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    creating kids media for tape

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW NODE TRIGGERED node:Create adult media (file)[id=5] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    creating adult media for tape

                    null process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    BEFORE RULEFLOW NODE TRIGGERED node:Begin lookup [id=7] process:Media Acquiring[id=com.mycompany.MediaAcquiring-processMaterial]

                    Hibernate: select hibernate_sequence.nextval from dual

                    • 7. Re: only the first human task is being saved in db!
                      Odelya Holiday Novice

                      I just debugged the application and I see the difference between the first and the second one.

                       

                      I start my application like this:

                       

                      pi = ksession.startProcess("com.mycompany.MediaAcquiring", parameters);

                      int i=5; //just for debugging.

                       

                      The workflow executes the processes, reaches the first human task and since it has to wait for completing "it finishes the execusion" and continues to the next line. (int i=5;)

                       

                      In the second one, I just call the human task to complete like this:

                       

                      BlockingTaskOperationResponseHandler blockingTaskOperationResponseHandler = new BlockingTaskOperationResponseHandler();

                      taskClient.complete(taskId, nickName, null, blockingTaskOperationResponseHandler);

                       

                      and I see that the task is not being saved after

                      client.addTask(task, content, null)) in the humantaskhandler, but later on in the process in one of the classes that implement PollingIoProcessor of Mina.

                       

                      How can make it that it will all be executed after client.addTask(task, content, null))?

                       

                      I don't handle the transactions myself since I understood that CommandBasedWSHumanTaskHandler handles it.

                      • 8. Re: only the first human task is being saved in db!
                        Mauricio Salatino Master

                        Looks like you are finishing just one task. or are you calling the following code twice?

                        BlockingTaskOperationResponseHandler blockingTaskOperationResponseHandler = new BlockingTaskOperationResponseHandler();

                        taskClient.complete(taskId, nickName, null, blockingTaskOperationResponseHandler);

                         

                        Where are you querying for the current tasks?

                         

                        Greetings.

                        • 9. Re: only the first human task is being saved in db!
                          Odelya Holiday Novice

                          After finishing the first task I expect with BlockingTaskOperationResponseHandler I expect the second one to be invoked and save in the DB I query for the user's tasks here:

                          (I created my own Human task handler which is exactly like CommandBasedWSHumanTaskHandler  except fo the fact that I need to send web service about the new human task to an external system. I need to send the new task id to the tem that will send to me web service once the task was completed with task id.

                           

                          public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {

                          connect();

                            .... (here it's the same code as CommandBasedWSHumanTaskHandler  )

                          ....

                          client.addTask(task, content, null);

                          //starting my code. I need the new task id from the db.

                                       BlockingGetTaskResponseHandler handler = new BlockingGetTaskResponseHandler();

                                              client.getTaskByWorkItemId(workItem.getId(), handler);

                            Task task2 = handler.getTask();

                          //needs to send web service

                          WebServicesUtil.startSendNotification(taskId);

                          ..

                          }

                           

                          Since it's a general behaviour for every human task - I had to define it in handler, and now I am stuck with the second human task id

                          • 10. Re: only the first human task is being saved in db!
                            Mauricio Salatino Master

                            Hehe.. now I think I understand your problem. Looks like you are trying to finish or get the task using the workItemId. That's not the best way to get your business tasks fromt he task server. In normal situations you will use another method from that client called getTaskByPotentialOwner() did you see how I used that method in the Emergency Service Demo? Using that method you can create the End Users Tasks lists by roles or per user. Using that kind of methods you don't need to know the workItemId related with the task, the user will only need to get the task and complete it, the engine will do the rest.

                             

                            Greetings.

                            • 11. Re: only the first human task is being saved in db!
                              Odelya Holiday Novice

                              Thanks. I know.

                               

                              But it still does not help me.

                               

                              I need to send web service whenever the flow reaches human task.

                               

                              So my solution was to take the same code as in CommandBasedWSHumanTaskHandler  and add in execute method call to web service.

                               

                              It will not help to use getTaskByPotentialOwner() since during the execute method the task is not saved in DB so I can't send the web service with the task id..

                              • 12. Re: only the first human task is being saved in db!
                                Mauricio Salatino Master

                                So, that's the problem. If you replace the CommandBasedWSHumanTaskHandler you will not see the task persisted until it ends the execution and commit the transaction. I think that you find the cause of your problem. If you want to call a web service after or before the human task was created you can add a different node to do that or add an event listener that do that for you.

                                Greetings.

                                1 of 1 people found this helpful
                                • 13. Re: only the first human task is being saved in db!
                                  Odelya Holiday Novice

                                  1. I don't really replace it - I just extend the execute method to call web service.

                                  2.

                                  So I should implement TaskEventListener?

                                   

                                  I looked for documentation but didn't find where I can register it and define it in my code.

                                   

                                  Can you please refer me to documentation how to use it for Human task?

                                  • 14. Re: only the first human task is being saved in db!
                                    Mauricio Salatino Master

                                    You can use the ProcessEventListener for all types of nodes inside your processes. Inside it you can check if for that task you need to call an external service. Using that approach it's not recommended and I personally prefer to add an aditional node to make the call explicit in my process.

                                    Greetings.

                                    1 of 1 people found this helpful
                                    1 2 Previous Next