I'm integrating jBPM 4.4 into an existing Spring application (2.5.6) and believe I have everything running (transactions, persistence, jobexecutor, etc) without any obvious failures. I'm slowly building a process that is supposed to send out an email, wait for user responses, etc. This means using the built-in mail activity to send out the email. Since the code starting the process isn't mean't to perform the entire process the mail activity is setup continue='async' (hopefully) allowing the jobexecutor to handle the actual sending of the email.
Unfortunately I can't figure out how to handle smtp errors using the build-in activity. For instance, the smtp server is down, the supplied email address is invalid (not a bounce), etc. Experimenting shows that the mail activity fails (errors in the error log) and the process stays in the mail activity. Once this occurs the jobexecutor never restarts the activity. I've seen multiple references to exception handling (including section 9.6 of the developers guide) but no real examples of how to handle this type of case.
So I figured I would ask what the best practices are for handling this. It seems like my options are:
- Figure out how to have an exception cause a transition to some node that I can put logic in to figure out how to handle it and proceed accordingly. For transient errors I would imagine some sort of timer/retry would be appropriate.
- Extend the mail activity implementation and add the logic there. The only issue I'm not sure about is how to "find" the transition names I want to transition to without hard-coding them into the java code (i.e., how to define them in the mail activity jpdl to be retrieved and used in the java code). Also it seems like others would have this problem so I feel like I'm reinventing the wheel a bit here.
- ??? - some way that I haven't thought of?
I'm the first to admit I'm a newbie to jBPM. This is my first real process that isn't an example/poc. Any suggestions, pointers, etc would be highly valued.