Skip to main content

Version: 22.04

Delivery Process

The Delivery Process service is used to deliver data associated with a completed submission, including submitted form XML, file attachments and the PDF receipt document to external systems.

Service Invoke Parameters

Parameters are not nullable except where otherwise indicated.

ParameterDescription
svcDefSvcDef
A service definition value object.
txnTxn
A transaction record value object.

Error Handling

Submission delivery is performed asynchronously by a background job. If a delivery process error occurs, the end user never sees this error.

If an exception is thrown by the Delivery Process, the SubmissionDeliveryController makes the submission delivery status Error, and logs the error in the Journey Manager database error log.

note

If an unhandled error is thrown by the Delivery Process, the SubmissionDeliveryController rolls back the current delivery transaction. Any Journey Manager database changed performed by the Groovy script is rolled back with the transaction, including any delivery checkpoint changes.

If the Service Definition is configured to perform a number of automatic retry attempts, the submission is scheduled to retry delivery after a configured period of time.

Templates

Service

import com.avoka.tm.util.*
import com.avoka.tm.vo.*

class FluentDeliveryProcess {

// Injected at runtime
public Logger logger

/*
* Perform Transaction Delivery Process
*
* returns: null if completed or DeliveryResult objet
*/
DeliveryResult invoke(SvcDef svcDef, Txn txn) {

try {
// TODO: perform delivery work

return new DeliveryResultBuilder()
.setStatus(Txn.DELIVERY_COMPLETED)
.build()

} catch (Exception e) {
return new DeliveryResultBuilder()
.setMaxDeliveryAttempts(5)
.setMessage(e)
.setNextDeliveryMins(30)
.setStatus(Txn.DELIVERY_ERROR)
.build()
}
}
}}

Unit Test

import com.avoka.tm.svc.*
import com.avoka.tm.test.*
import com.avoka.tm.util.*
import com.avoka.tm.vo.*
import org.junit.*

class UnitTest extends AbstractJUnitTest {

// Injected at runtime
public static Logger logger

/*
* Perform service unit test
*
* throws: exception if unit test fails
*/
@Test
void testDeliveryCompleted() throws Exception {

String xmlData = testParams['Test XML Data']
Txn txn = new MockVoBuilder().createTxnDeliveryReadyWithXml(xmlData)

Map params = [
"svcDef": svcDef,
"txn": txn
]

DeliveryResult result = (DeliveryResult) new ServiceInvoker(svcDef).invoke(params)

// Check result
logger.info result

assert result.status == Txn.DELIVERY_COMPLETED
}
}