Discussion:
[jboss-user] [jBPM] - Exception handling for technical exceptions
M S
2012-06-20 13:41:59 UTC
Permalink
M S [https://community.jboss.org/people/marcomr] created the discussion

"Exception handling for technical exceptions"

To view the discussion, visit: https://community.jboss.org/message/743088#743088

--------------------------------------------------------------
Hello.
I have a scenario where a java exception inside a work item handler should abort the workflow execution. Up until now I've been mapping this java exception to a business exception (following a suggestion by Kris in which I map the exception as an exit variable and signal from an exit action if said variable is filled) but I'd like to hide this complexity from the modellers: they should know that a service task could abort the workflow and not have to model error events for this.
I see that older jBPM versions had the concept of a global exception handler. Is there any similar concept in 5.3?
What is the best approach to handle this scenario?

Regards,
Marco
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/743088#743088]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2012-06-22 16:21:47 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Exception handling for technical exceptions"

To view the discussion, visit: https://community.jboss.org/message/743738#743738

--------------------------------------------------------------
Perhaps having this logic inside work item handler that can take this complexity - so you will have a custom work item handler implementation that acts like a wrapper for other work item handlers (service task human task, etc) and can perform exception handling if such a need arise. Wdyt?

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/743738#743738]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
M S
2012-06-26 10:45:51 UTC
Permalink
M S [https://community.jboss.org/people/marcomr] created the discussion

"Re: Exception handling for technical exceptions"

To view the discussion, visit: https://community.jboss.org/message/744198#744198

--------------------------------------------------------------
Hi Maciej,
thanks for your answer.

That would be my preferred approach. My only doubt is how would I perform the handling from this wrapper.
I've looked into the KnowledgeSessionAware interface solution that Kris suggested in other topic ( https://community.jboss.org/thread/168600 https://community.jboss.org/thread/168600) and have this implemented in an embedded scenario, but I'm not sure how I'd implement this to work on processes initiated via the jbpm-console without having to fork jBPM code. Also Kris provided an implementation for a work item handler that is session aware (in https://github.com/droolsjbpm/jbpm/blob/master/jbpm-workitems/src/main/java/org/jbpm/process/workitem/AbstractWorkItemHandler.java#L40 https://github.com/droolsjbpm/jbpm/blob/master/jbpm-workitems/src/main/java/org/jbpm/process/workitem/AbstractWorkItemHandler.java#L40) but again I couldn't find any integration with a jbpm-console started process.

So is there any preferred approach for this? Is it possible, if we go the signaling route, by configuration, to switch the work item manager used by jbpm-console so that it passes the session to the handlers?

Thanks for your time!
Best regards,
Marco
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/744198#744198]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2012-06-27 20:06:38 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Exception handling for technical exceptions"

To view the discussion, visit: https://community.jboss.org/message/744632#744632

--------------------------------------------------------------
Yeah, I would recommend to use AbstractWorkItemHandler as a base class for all your handlers so you'll get access to session.

As it comes to using that handler in console, you could declare your custom work item handlers inside CustomWorkItemHandlers.conf that is located inside gwt-console-server.war/WEB-INF/classess/META-INF. Just one note, I believe session won't be injected into it. If you don't mind to have a handler that is tightly coupled with console code you could look it up using signleton object StatefulKnowledgeSessionUtil.getStatefulKnowledgeSession().

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/744632#744632]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
M S
2012-06-29 10:52:57 UTC
Permalink
M S [https://community.jboss.org/people/marcomr] created the discussion

"Re: Exception handling for technical exceptions"

To view the discussion, visit: https://community.jboss.org/message/745007#745007

--------------------------------------------------------------
Hi Maciej,
I've implemented your proposed solution. The tight coupling here isn't really an issue for me, so I went with that approach and it's working great!

Many thanks for your help!
Best regards,
Marco
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/745007#745007]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Prathap V S
2013-02-13 12:38:33 UTC
Permalink
Prathap V S [https://community.jboss.org/people/prathap.vs] created the discussion

"Re: Exception handling for technical exceptions"

To view the discussion, visit: https://community.jboss.org/message/797447#797447

--------------------------------------------------------------
Hi Marco,
   Can i know how you implemented above proposed solution. I am not able to access session in my custom work item handler.

Thanks,
Prathap
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/797447#797447]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...