<!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;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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;"> </p><p>Like what is the difference between (Impl 1): </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><blockquote class="jive-quote"> <task-node name=<span style="color: red;">"step1"</span> end-tasks=<span style="color: red;">"true"</span>><br/> <event type=<span style="color: red;">"node-enter"</span>><br/> <create-timer name=<span style="color: red;">"myTimeout"</span> duedate=<span style="color: red;">"1 minute"</span> transition=<span style="color: red;">"toExpire"</span>><br/> <action name=<span style="color: red;">"testWriteOut"</span> expression=<span style="color: red;">"#{timerLogger.logTimer}"</span>/><br/> </create-timer><br/> </event><br/> <task name=<span style="color: red;">"taskA"</span> description=<span style="color: red;">"task 1"</span>><br/> <assignment actor-id=<span style="color: red;">"userA"</span> /><br/> </task><br/> <transition name=<span style="color: red;">"finished"</span> to=<span style="color: red;">"end"</span>/><br/> <transition name=<span style="color: red;">"toExpire"</span> to=<span style="color: red;">"expire"</span>/><br/> </task-node></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>And this (Impl 2):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><blockquote class="jive-quote"><task-node name=<span style="color: red;">"timerTest"</span>><br/> <br/> <task name=<span style="color: red;">"taskA"</span> description=<span style="color: red;">"TimerTestTask"</span>><br/> <assignment actor-id=<span style="color: red;">"userA"</span> /><br/>  <timer duedate=<span style="color: red;">"1 minute"</span> transition=<span style="color: red;">"finished"</span>><br/> <action expression=<span style="color: red;">"#{timerTestWorkflow.logTimerFired}"</span> /><br/> </timer><br/> </task><br/> <transition name=<span style="color: red;">"finished"</span> to=<span style="color: red;">"end"</span> /><br/> </task-node></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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  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;"> </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;"> </p><blockquote class="jive-quote"><p><state name="timerstate"></p><p> <timer name="wait one minute" duedate="1 minute" transition="toTaskB"> </p><p> </timer></p><p> <transition to="taskB" name="toTaskB"></transition></p><p></state></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></blockquote><p> and then transfer to tasknode B where taskB is assigned to userB.  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;"> </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;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>off topic: why arent there that many good examples for the timer. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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>