Class DeliveryResultBuilder

java.lang.Object
com.avoka.tm.util.DeliveryResultBuilder

public class DeliveryResultBuilder extends Object

Provides a transaction delivery process result DeliveryResult builder.

Using the delivery result object you specify to Journey Manager whether the delivery has been completed, or what addition delivery processing is required.

Delivery statuses include:

  • Not Ready - the transaction is not ready for delivery
  • Ready - the transaction is ready for delivery processing
  • In Progress - the transaction delivery is in progress
  • Pending - the transaction delivery is paused waiting for an external event to continue processing
  • Completed - the transaction delivery has been completed
  • Error - an error occurred performing delivery, and delivery may be retried
  • Undeliverable - the transaction is undeliverable, and no further delivery attempts will be performed

Examples

Please find the transaction delivery process result builder examples below.

Delivery Completed Example

This example shows how to build a delivery Completed result.

 return new DeliveryResultBuilder()
     .setStatus("Completed")
     .build() 

Delivery Error Example

This example shows how to build a delivery Error result, with the given exception as the delivery message, and set to retry in 30 minutes time for a maximum of 5 delivery attempts.

 return new DeliveryResultBuilder()
     .setMaxDeliveryAttempts(5)
     .setMessage(exception)
     .setNextDeliveryMins(30)
     .setStatus("Error")
     .build() 

Delivery Channel Example

This example shows how set the delivery channel to the "REST Delivery Service" and set the delivery status to "Ready".

 return new DeliveryResultBuilder()
     .setStatus("Ready")
     .setDeliveryChannel("REST Delivery Service")
     .build() 
Since:
5.0
See Also:
  • Constructor Details

    • DeliveryResultBuilder

      public DeliveryResultBuilder()
  • Method Details

    • setStatus

      public DeliveryResultBuilder setStatus(String status)
      The delivery process result status [ Not Ready | Ready | In Progress | Pending | Completed | Error | Undeliverable ].
      Parameters:
      status - delivery process result status (required)
      Returns:
      the delivery result builder
    • setMessage

      public DeliveryResultBuilder setMessage(Object message)
      The delivery process result message.
      Parameters:
      message - delivery process result message
      Returns:
      the delivery result builder
    • setNextDeliveryTime

      public DeliveryResultBuilder setNextDeliveryTime(Date nextDeliveryTime)
      The next time to attempt to execute the delivery process.
      Parameters:
      nextDeliveryTime - the next time to attempt to delivery process execution
      Returns:
      the delivery result builder
    • setNextDeliveryMins

      public DeliveryResultBuilder setNextDeliveryMins(int minutes)
      The next time in minutes to attempt to execute the delivery process.
      Parameters:
      minutes - the next time in minutes to attempt to delivery process execution
      Returns:
      the delivery result builder
    • setMaxDeliveryAttempts

      public DeliveryResultBuilder setMaxDeliveryAttempts(int maxDeliveryAttempts)
      The maximum number of delivery attempts to perform.
      Parameters:
      maxDeliveryAttempts - the maximum number of delivery attempts to perform
      Returns:
      the delivery result builder
    • setDataPurgeTime

      public DeliveryResultBuilder setDataPurgeTime(Date dataPurgeTime)
      The scheduled transaction PII data purge time once delivery has been completed.
      Parameters:
      dataPurgeTime - the scheduled transaction PII data purge time once delivery has been completed
      Returns:
      the delivery result builder
    • setDeliveryChannel

      public DeliveryResultBuilder setDeliveryChannel(String deliveryChannel)
      Set the delivery channel.
      Parameters:
      deliveryChannel - the delivery channel
      Returns:
      the delivery result builder
      Since:
      5.0.2
    • build

      public DeliveryResult build()
      Return a new transaction delivery result object based on the specified properties.
      Returns:
      a new transaction delivery result object based on the specified properties.