<!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;">
    Timer in jBPM,
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/armahdi">Syed Mahdi</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/590244#590244">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 All,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am trying to create and incorporate a timer in my jBPM process definition I have found some examples but they dont really state what they exactly were doing:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Like what is the difference between (Impl 1): </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"> &lt;task-node name=<span style="color: red;">"step1"</span> end-tasks=<span style="color: red;">"true"</span>&gt;<br/> &lt;event type=<span style="color: red;">"node-enter"</span>&gt;<br/> &lt;create-timer name=<span style="color: red;">"myTimeout"</span> duedate=<span style="color: red;">"1 minute"</span> transition=<span style="color: red;">"toExpire"</span>&gt;<br/> &lt;action name=<span style="color: red;">"testWriteOut"</span> expression=<span style="color: red;">"#{timerLogger.logTimer}"</span>/&gt;<br/> &lt;/create-timer&gt;<br/> &lt;/event&gt;<br/> &lt;task name=<span style="color: red;">"taskA"</span> description=<span style="color: red;">"task 1"</span>&gt;<br/> &lt;assignment actor-id=<span style="color: red;">"userA"</span> /&gt;<br/> &lt;/task&gt;<br/> &lt;transition name=<span style="color: red;">"finished"</span> to=<span style="color: red;">"end"</span>/&gt;<br/> &lt;transition name=<span style="color: red;">"toExpire"</span> to=<span style="color: red;">"expire"</span>/&gt;<br/> &lt;/task-node&gt;</blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>And this (Impl 2):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote">&lt;task-node name=<span style="color: red;">"timerTest"</span>&gt;<br/> <br/> &lt;task name=<span style="color: red;">"taskA"</span> description=<span style="color: red;">"TimerTestTask"</span>&gt;<br/> &lt;assignment actor-id=<span style="color: red;">"userA"</span> /&gt;<br/>&#160; &lt;timer duedate=<span style="color: red;">"1 minute"</span> transition=<span style="color: red;">"finished"</span>&gt;<br/> &lt;action expression=<span style="color: red;">"#{timerTestWorkflow.logTimerFired}"</span> /&gt;<br/> &lt;/timer&gt;<br/> &lt;/task&gt;<br/> &lt;transition name=<span style="color: red;">"finished"</span> to=<span style="color: red;">"end"</span> /&gt;<br/> &lt;/task-node&gt;</blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>what is the basic difference between the two implementation. If i wanted a timer that will be executed after the task has ended which one is best for my use case. My use case is like this... UserA is assigned&#160; taskA and when he finishes, the jBPM waits for 1 hour and then assigns TaskB it to User B who can actually end the process. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Other way of seeing it is like UserA is assigned TaskA and when he finishes the taskA the token goes to task B and assigns it to UserB and waits there for 1 hour and notifies the UserB that timer is expired so he can end it. Or do you think I shud make a state for the timer it self like (Impl 3):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"><p>&lt;state name="timerstate"&gt;</p><p> &lt;timer name="wait one minute" duedate="1 minute" transition="toTaskB"&gt; </p><p> &lt;/timer&gt;</p><p> &lt;transition to="taskB" name="toTaskB"&gt;&lt;/transition&gt;</p><p>&lt;/state&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></blockquote><p> and then transfer to tasknode B where taskB is assigned to userB.&#160; but then it wont be assigned to any user in this state so it will not show up in the pooled task either. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>in impl 1 above if after 1 minute it tranistions to "toExpire" then how does the task in the task node gets executed</p><p>in Impl2 does the timer gets fired after 1 minute or instantly when it reaches the tasknode and if within a minute the userA does not do anything it finishes??? does it mean that userA will be assigned the task for 1 minute only... Is there a possibility then to fire an action after the 1 miute as well. ?? </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>off topic: why arent there that many good examples for the timer. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks</p><p>ARMahdi</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/590244#590244">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>