[jboss-user] [jBPM] - How to handle SMTP failures in a mail activity

Jeffrey Anuszczyk do-not-reply at jboss.com
Tue Aug 3 09:34:18 EDT 2010

Jeffrey Anuszczyk [http://community.jboss.org/people/jeffgreg] created the discussion

"How to handle SMTP failures in a mail activity"

To view the discussion, visit: http://community.jboss.org/message/555661#555661

   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:

1. 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.
2. 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.
3. ??? - 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.

- Jeff


Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100803/d9bdc918/attachment.html 

More information about the jboss-user mailing list