Timeouts are an essential element in business processes. Participants who have accepted a work item may be absent and a timeout can trigger an escalation to the next level. In other cases, there may be fixed deadlines to meet and certain activities do not make sense once they are passed. In many cases, timeouts are combined with cancellation - a topic that we have dealt with in the previous video. In this video we cover the topic of Timer Tasks in YAWL. They are easy to set up. The zip file attached here contains an initial and a final YAWL specification for following this tutorial on your own YAWL installation.
Hello and welcome back to another YAWL tutorial. Time-outs are useful when something takes too long. YAWLl has so-called timer tasks that allow you to stop waiting for the completion of a work item, when a certain time is reached or a time interval has elapsed. In this tutorial, we will show you how timer tasks work. Our example today is a silence procedure, where a proposition is accepted if no one rejects it in a certain time interval. As usual, you can find the workflow specification in the companion page following the link below on the screen. We have already our specification from the supplementary material open in the YAWL editor. The file is called Tutorial13.yawl and this specification is a silence procedure. So essentially, someone writes a proposal and then this proposal is distributed to three entities: A, B, and C, who can evaluate the proposal. If their evaluation is positive and all of them are positive, the same user that has written the proposal notes the acceptance of the proposal. If however, one of them rejects the proposal, we go here to this cancellation task and once this is completed, all of the other evaluations are cancelled as you can see from this cancellation region. Cancellation regions were a topic of the previous tutorial. Then "Note rejection" is executed and this is offered to the same user that has written the proposal. So what we want to do now is to introduce timer tasks for the evaluations. So if someone fails to evaluate the proposal in a given time interval, this means that the proposal is accepted from this perspective and our timer task can help us here. So let's edit timer tasks. We select "Evaluate proposal A" and on the left hand side we see timer. And if we click on the three dots, we now have the possibility to set a timer for this task. And we can set it either on offer or on start. On offer is the correct choice here. And then we have possibility to set, when the task expires. And we can either set an exact date, a fixed date, or we can say after a duration, or we can even do this via a variable. But for this variable, we need a variable in a specification. We will not cover this here now. What we will do is, we will do this "after a duration of". And then we have seconds, minutes, hours, days, and so on and so forth. So for testing purposes, we will set this to two minutes and click OK. And then we do the same for "Evaluate proposal B". We'll set this to two minutes and also for "Evaluate proposals C".
And you can see now that these tasks have this clock symbol here indicating that we have timer tasks. Here we save the specification and we upload it to the YAWL engine. We open the control center and we see that there is a case started with case ID 41. And "Write proposal" is in the unoffered work items. So we start that and write the proposal and complete it. So now we have the two minutes timer running. If we go to the admin queues, we can see "Evaluate proposal A" and we can see "expires in 1:51 and if we press refresh, you can see now it's 1:41 and so on and so forth. And the other tasks are the same. So we can see the time until the timer expires here. What we can also do is, we can evaluate one of the tasks - let's say this one - and we accept - let's say we accept it - and we write a comment and complete it now. So this one is a manually completed task. We go back to our overview here and we can see that these tasks expire. So if we now take one of them- let's say C - and start it.
Go to the work queues, and now we don't accept it here. We have now a task "Note rejection" because one rejection is enough and we can see that one of these evaluators has rejected the idea. And we see the comment and this is all gone. Now let's try a positive case with a timeout. We'll start another case and now let's say one of them accepts it again. And now we just have to wait until the two minutes are over. So it expires in four seconds and you can see now they have gone and we have "Note acceptance" here.
I'm sure you already have an idea where to use timer tasks. If you do this and are successful, please let me know in the comments below. See you next time!