2 Replies Latest reply on Jun 26, 2006 6:06 AM by tom.baeyens

    Observer / Listener pattern on jBPM process execution?

      Hello.

      I am trying to implement a mechanism for real-time observing and monitoring the execution of jBPM processes. In particular, I need global notification of:

      * Every time a new process (or sub process) is created
      * Every time a process instance transitions to a new state
      * Every time a process ends (including end time)

      I notice there is support for adding RuntimeAction handlers dynamically in this post:

      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=70734

      However, it seems this mechanism would require me to hook every node and event type of every process instance explicitly.

      Furthermore, it appears that it is not possible to get notification of processes ending using the event handler mechanism - I can add a 'node-enter' handler to the end-state, however when this is called the process is still running, and hence the process instance end time field is still null!

      Is there a mechanism that I might have missed that can support what I am trying to do? Alternatively, does it make sense to support a node-leave handler on the end-state, that is only called once the process instance has been marked with an end time?

      It seems to me that the Logging system might be ideally positioned to implement such an observer mechanism. Is there an easy way of hooking a callback handler to receive log events on the fly?

      Thanks.

        • 1. Re: Observer / Listener pattern on jBPM process execution?
          kukeltje

          One solution we (the company I work for) are thinking of for a kind of BAM solution is to periodically poll the DB. This way we do not have to change any code in jBPM and retrieving all starts, node enters and end since the last poll (we keep the ID of the last log record) doe not lead to a major performance issue. We think of polling the DB every 5 minutes.

          This solutution is used by more BAM suppliers to be able to do things without having to work with BPM suppliers to adapt the BPM engine.

          • 2. Re: Observer / Listener pattern on jBPM process execution?
            tom.baeyens

            check out event propagation in the docs: you can associate an action with a process definition. after that you're notified of all that kind of events inside of the process.

            there is no event/action mechanism spanning all process definitions in a jbpm installation.