1 Reply Latest reply on Jul 13, 2012 10:54 AM by Maciej Swiderski

    Logging node-level variable info

    Bob Walker Newbie

      Hi,

       

      [Stack info: jBPM 5.3.0, Java 1.7, developing on Windows 7, logging to Oracle 11gR2 database, standalone JVM app (i.e. not in any container), using Spring 3.1.1. We join an existing transaction from Oracle before the jBPM process is invoked].

       

      We're trying to create an audit trail through a given process flow and we need to log the state of one or more context variables at the point the flow either enters and exists a given node, and be able to identify the individual process run and what the data was at any point during that process.

       

      We aren't currently persisting the process info (we don't have a requirement to intervene in flows), and there doesn't seem to be ay obvious way to link the variable info at the node level to a specific process info - when we log out the process info id, it is always 1. Do we have to persist the process info to get unique ids for subsequent processes?

       

      It seems a really obvious thing to need to do, but seems really difficult to implement - am I missing something?

       

      Any help gratefully received.

       

      Regards,

       

      Bob

        • 1. Re: Logging node-level variable info
          Maciej Swiderski Master

          ProcessEventListener is designed to provide you with such capability, so you can build your custom implementation of that interface and register it on the session. It will trigger all enter/exit nodes and you can get quite some information out of it including variables and process instance.

           

          About unique ids of process instance, I believe you recreate session for each process and if that's the case you'll get ids of the process instances to be reset and they will start with 1... so if you enable persistence you'll get ids generated by db so they will be unique. Alternatively you could implement you own ProcessInstanceManager and ProcessInstanceManagerFactory that can be registered on the session which will be responsible for generating unique ids of process instances (org.jbpm.process.instance.ProcessInstanceManager, org.jbpm.process.instance.ProcessInstanceManagerFactory).

           

          if you like to go this way once you have your implementation you can register it like this:

          sessionProperties.put("drools.processInstanceManagerFactory", "YOUR CUSTOM CLASSNAME");

          KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(sessionProperties);

          kbase.newStatefulKnowledgeSession(config, environment);

           

          There could be need to implement SignalManager and SignalManagerFactory as well...

           

          HTH