5 Replies Latest reply on Jan 23, 2012 10:10 AM by gardellajp

    Listener not call when complete a task

    gardellajp Newbie

      Hi,

       

      I have a problem related to loggers attached to a loaded session, they are not called when I complete a task. There are the steps:

       

      1) Start a process:

       

      <<<< CODE >>>>

       

      //Create the session

       

      StatefulKnowledgeSession session = JPAKnowledgeService.newStatefulKnowledgeSession(knowledgeBase, null, envoriment);

       

      CommandBasedWSHumanTaskHandler handler = new CommandBasedWSHumanTaskHandler(session);

      session.getWorkItemManager().registerWorkItemHandler("Human Task",handler);

       

      //add logger

      KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newConsoleLogger(session);

       

      //start a new process

      session.startProcess("myprocess");

       

      //close resources

      logger.close();

       

      session.dispose();

       

      <<<< END CODE >>>>

       

      At this point, console logger works and in console I see what are happening.

       

      2) End some Task

       

      Later, in the app, I choose a task and I want complete it.

       

      << CODE>>>

      TaskClient client = obtainATaskClient();

      client.getTask(taskId,handler);

       

      Task task = handler.getTask();

       

      //obtain the session

      int sessionId = task.getTaskData().getProcessSessionId();

      StatefulKnowledgeSession session = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId,knowledgeBase, null, envoriment);

      CommandBasedWSHumanTaskHandler handler = new CommandBasedWSHumanTaskHandler(session);

      session.getWorkItemManager().registerWorkItemHandler("Human Task",handler);

       

      //add logger

      KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newConsoleLogger(session);

       

      //complete the task

      client.complete(taskId, userId, outputData, responseHandler);

       

      isDone = responseHandler.waitTillDone(time);

       

      logger.close();

       

      session.dispose();

       

      <<< END CODE >>>>

       

      The problem is that in the step 2, the logger never call. How can I make the step 2 works? I see in console that the handler is call becouse I see the generated sql.

       

      Thanks,

      Juan