7 Replies Latest reply on Aug 5, 2009 5:11 AM by kukeltje

    jBPM4 and Event-Handling

    djcye

      Hi,
      i studied the docs but some questions are left - i hope u know better:

      1. Can a Event-Listener react on an Event raised by another Process (or Subprocess) ?
      2. Do you know which kinds of Event it is possible to Listen at? In the examples i only found "timeout", "end", "start".. is it possible to define own Events that could be fired ?

      Example:


      <event-listener class="org.jbpm.examples.timer.event.Escalate" />


      thanks

        • 1. Re: jBPM4 and Event-Handling
          djcye

           

          <state name="guardedWait" g="98,46,127,52">
           <on event="timeout">
           <timer duedate="10 minutes"/>
           <event-listener class="org.jbpm.examples.timer.event.Escalate" />
           </on>


          *Example got crushed

          • 2. Re: jBPM4 and Event-Handling
            kukeltje

            1: no
            2: I have no complete list, but I think most from 3.x are still valid like task-end, node-leave, node-enter, etc. And ofcourse all own fired event. It is just a string.

            And example of the latter can be found in the testcases in the source (not the source of the examples, the real unittests)

            • 3. Re: jBPM4 and Event-Handling
              kukeltje

              1: Not sure about subprocesses, if they bubble up.

              • 4. Re: jBPM4 and Event-Handling
                djcye

                thx!

                so i am not able to recieve or react to any event (lets say a storno-event which would cause the process to cancel) from outside the process ?

                i ll try a subprocess example

                • 5. Re: jBPM4 and Event-Handling
                  kukeltje

                  No, not directly. But
                  - You can always use the api to end the process
                  - Use the api to explicitly send trigger to the process that causes the event (like you asked in 2). The thing is that you need to know which processinstance to trigger. But most of the time you have a reference to it, either by storing the processid in your own datamodel or putting the businesskey of your datamodel in the processinstance.

                  • 6. Re: jBPM4 and Event-Handling
                    djcye

                    thanks for explanations

                    just for the case that i got it wrong: the eventlistener react on events within the flow but not on an triggered event (like cancel) which could cause the process to take an alternative flow (for compensating tasks)

                    • 7. Re: jBPM4 and Event-Handling
                      kukeltje

                      cancel where? of one task? if that triggers an event, you can react on it.

                      Best is to play with it a little