Okay, here my proposal.
Add to GraphElement:
| /**
| * notify configured external event listeners of fired event.
| *
| * The notification is done BEFORE the event gets processed by jbpm
| * internally (meaning actions are executed), so it is visible
| * to the listeners even if exceptions occur inside of the actions
| * causing the stacktrace to abort
| */
| private void notifyListenerOfEvent(String eventType, ExecutionContext
executionContext) {
| EventListenerUtil.notifyListenerOfEvent(eventType, executionContext);
| }
|
and call this method inside of the "fireAndPropagateEvent" method.
Now my first thought was, that the EventListenerUtil looks up jbpm.cfg.xnml via
JbpmConfiguration to see if there is a bean "jbpm.event.listener" configured,
e.g.
| <bean name="jbpm.event.listener" class="MyEventListener">
|
Or to create some kind of jbpm event dispatcher to support a list of listeners:
| <bean name="jbpm.event.dispatcher" class="org.jbpm.NN">
| <field name="listeners">
| <list>
| <bean class="MyEventListener1" />
| <bean class="MyEventListener2" />
| </list>
| </field>
| </bean>
|
The code isn't hard there, just check in the JbpmConfiguration if the listener is/the
listeners are set and if then call the listener.
What do you guys think? What would you prefer, simple one listener (so people with
multiple listeners have to implement that themselvers) or multiple listeners?
This is a really powerfull machnism to hook into jbpm and to develop generic solutions
around it, e.g. for BAM.... And it is not a big deal. I would like to start on this next
week, hopefully we can come to some conclusions here. When finished I can also blog about
how I use this to generate the BAM events we need in the project...
Cheers and have a nice weekend
Bernd
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191350#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...