Version: 22.04
Task Expiry Process
The Task Expiry Process is called by the Transaction Processor job when a task has expired. A task is considered to have expired when it has not been completed by its scheduled expiry date. Expired tasks are removed from users' Task List.
This service is configured via the Form Version Services tab.
Service Invoke Parameters
Parameters are not nullable except where otherwise indicated.
Parameter | Description |
---|---|
svcDef | SvcDef A service definition value object. |
txn | Txn A transaction record value object. |
Error Handling
If an error occurs while attempting to expire a task, the error is recorded in the Journey Manager database error log. A Task Expiry service can be configured with a maximum number of attempts to retry expiring a task automatically. By default, this is 5 attempts.
Templates
Service
import com.avoka.core.groovy.GroovyLogger as logger
import com.avoka.tm.svc.*
import com.avoka.tm.vo.*
class FluentTaskExpiry {
/*
* Perform Task expiry process
*/
void invoke(SvcDef svcDef, Txn txn) {
// TODO: perform task expiry work
String msg = txn.formStatus + " task " + txn.trackingCode + " assigned to " + txn.emailAddress + " has expired"
new Emailer()
.setToAddress("[email protected]")
.setSubject("Task " + txn.trackingCode + " - " + txn.formStatus + " has expired")
.setMessage(msg)
.setTxn(txn)
.sendEmail()
new EventLogger()
.setMessage(msg)
.setTxn(txn)
.logInfo()
}
}
Unit Test
import com.avoka.core.groovy.GroovyLogger as logger
import com.avoka.tm.svc.*
import com.avoka.tm.test.*
import com.avoka.tm.vo.*
import org.junit.Test
class UnitTest extends AbstractJUnitTest {
/*
* Perform service unit test
*
* throws exception if unit test fails
*/
@Test
void testExpired() throws Exception {
String formXml = testParams['Test XML Data']
Txn txn = new MockVoBuilder().createTxnTaskWithXml(formXml)
Map params = [
"svcDef": svcDef,
"txn": txn
]
new ServiceInvoker(svcDef).invoke(params)
}
}