<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    How to handle SMTP failures in a mail activity
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/jeffgreg">Jeffrey Anuszczyk</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/555661#555661">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p>&#160;&#160; 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.&#160; I'm slowly building a process that is supposed to send out an email, wait for user responses, etc.&#160; This means using the built-in mail activity to send out the email.&#160; 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. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160; Unfortunately I can't figure out how to handle smtp errors using the build-in activity.&#160; For instance, the smtp server is down, the supplied email address is invalid (not a bounce), etc.&#160; Experimenting shows that the mail activity fails (errors in the error log) and the process stays in the mail activity.&#160; Once this occurs the jobexecutor never restarts the activity.&#160; 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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160; So I figured I would ask what the best practices are for handling this.&#160; It seems like my options are:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ol><li>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.&#160; For transient errors I would imagine some sort of timer/retry would be appropriate.</li><li>Extend the mail activity implementation and add the logic there.&#160; 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).&#160; Also it seems like others would have this problem so I feel like I'm reinventing the wheel a bit here.</li><li>??? - some way that I haven't thought of?</li></ol><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I'm the first to admit I'm a newbie to jBPM.&#160; This is my first real process that isn't an example/poc.&#160; Any suggestions, pointers, etc would be highly valued.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks,</p><p>- Jeff</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/555661#555661">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>