Hi,
I want to affect the flow from Execution Listeners of all types of Message Catch or Throw Events and Start Message Event by allowing an error to be forwarded to an Error Start Event in an event subprocess.
Below are my thoughts and questions, but if I am on a wrong route from the beginning and there is a correct and less hacky way of doing this, please advise.
I tried to throw BPMNError in a Start Listener but I am suspecting that this error is never caught from Listeners. Is that correct? As the doc states, you can only throw this business type of error from a Java Delegate. And a Java Delegate is only able to be set into the certain types elements, excluding the message elements.
So due to the nature of my task and what I have already developed, I may only rely only on listeners but I still want to throw BPMNErrors from them.
I am thinking that on parse stage, if I substitute the behaviour objects of message events with my own wrapper implementation, that will first look into a thread local variable for a BPMNError generated right before it in the Start listener before, fire it if found, or otherwise run the original behaviour class execute
method, will it make sense? I mean, if I take the AbstractBpmnActivityBehavior
as a base class for my wrapper, perform an executeWithErrorPropagation
with some simple code that checks my threadlocal, and then add there the code that runs the wrapped behaviour execute
method, will it work?
Additional thought why this might not work that many behaviour implementations are much more complex than just plain execute
, so would I probably need to extend all of the behaviour classes, like IntermediateCatchEventActivityBehavior
and whatever I may encouter. Or is it overcomplicating things? (Besides what I have already complicated )
Last small question is how am I supposed to set a Java Delegate to a Throw Message Event programmatically during the parse time.The ServiceTaskJavaDelegateActivityBehavior
which I guess is working for the Throw tase seems to miss an open method for doing this.
Thanks and how else can I thank you guys for helping me? =)