2 Replies Latest reply on May 18, 2011 8:39 PM by cristiano.nicolai

    Different WorkItemManager objects

    cristiano.nicolai

      Hi guys,

       

       

      I'm playing with a JPA StatefulKnowledgeSession and just realized that the WorkItemManager instance received as parameter on my WorkItemHandler isn't the same object that I get when I call ksession.getWorkItemManager().

       

      WorkItemHandler: org.drools.persistence.jpa.processinstance.JPAWorkItemManager@48dfaa07

      ksession.getWorkItemManager(): org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1@6de525a1

       

      I understand that a CommandBasedStatefulKnowledgeSession uses a CommandService to encapsulate a single session and probably what I'm receiving on my handler is the manager associated to this session and not the one available on the CommandBasedStatefulKnowledgeSession.

       

      I faced this situation because I tried to update the CommandBasedWSHumanTaskHandler to not depend on a KnowledgeSession and only use the WorkItemManager received as parameter, but then some problems started to happen.

       

      Just want to understand if this should be considered as a normal behavior.

        • 1. Different WorkItemManager objects
          salaboy21

          Hi Cristiano,

          Can you explain a little bit more what are you trying to solve doing:

           

          "I faced this situation because I tried to update the CommandBasedWSHumanTaskHandler to not depend on a KnowledgeSession and only use the WorkItemManager received as parameter, but then some problems started to happen."

           

          If you don't use the ksession inside the CommandBasedWSHumanTaskHandler the HumanTaskHandler will not be able to notify the session when a task is being completed, so your process will not be signaled to continue to the next node.

          Greetings.

          • 2. Different WorkItemManager objects
            cristiano.nicolai

            My first goal is to be able to define the CommandBasedWSHumanTaskHandler using drools.session.conf. This will allow me to have different implementations for dev, prod environments. Today, this is the only handler that needs to be hard coded because it receive a session as parameter on his constructor.

             

            Having a look in the CommandBasedWSHumanTaskHandler code the session is used only to get the WorkingItemManager, for this reason I thought that I could simply use the WorkingItemManager received as parameter on executeWorkItem or abortWorkItem.

             

            I hope to make it more clear now