Storing Execution Information

Payment Entries Executor keeps track of progress for Payment Instruction being processed. This provides observability, and more importantly, a resume point in case of any unexpected errors.

Execution Info

Domain entity holding the information about processing of the specific instruction is defined in the following way:

package com.iconsolutions.ipf.core.releaser;

import com.iconsolutions.ipf.core.shared.domain.context.UnitOfWorkId;
import lombok.Builder;
import lombok.Data;
import lombok.NonNull;

import java.time.Instant;

/**
 * Holds info about the processing status of a single payment instruction and all payment transactions related to it.
 * <p>
 * For each instruction we track:
 * <br> - general processing status for the instruction and Action type, and
 * <br> - UnitOfWorkId of the last payment transaction being successfully processed, for this payment instruction and Action type
 */
@Data
@Builder(toBuilder = true)
public class ExecutionInfo {

    /**
     * UnitOfWorkId of the payment instruction
     */
    @NonNull
    private final UnitOfWorkId unitOfWorkId;

    /**
     * UnitOfWorkId of the last (instruction-related) payment transaction being successfully processed
     */
    private final UnitOfWorkId offset;

    /**
     * Processing status for the instruction and Action type
     */
    private final Status status;

    /**
     * Holds data for processing payments that is not related to the tracking of the execution.
     */
    @NonNull
    private final PaymentHandlingInfo paymentHandlingInfo;

    /**
     * TTL represents time in seconds after which the record will expire.
     * This field is unique to Azure CosmosDB (must be an int named "ttl")
     */
    private Integer ttl;
    /**
     * Represents the exact instant when this record is eligible for deletion.
     * MongoDB requires a field to be a date type.
     */
    private Instant expiryDate;

    public enum Status {
        PENDING_START,
        IN_PROGRESS,
        FAILURE,
        COMPLETE;
    }

}

MongoDB implementation

ExecutionInfoStore interface defines 2 separate methods:

  • Mono<ExecutionInfo> save(ExecutionInfo executionInfo)

  • Mono<ExecutionInfo> findByUnitOfWorkIdAndActionType(UnitOfWorkId id, String actionType)

and is implemented by MongoExecutionInfoStore, using MongoDB database for storing and retrieving processing information.