Skip to content

/AWS1/IF_LMD=>CHECKPOINTDURABLEEXECUTION()

About CheckpointDurableExecution

Saves the progress of a durable function execution during runtime. This API is used by the Lambda durable functions SDK to checkpoint completed steps and schedule asynchronous operations. You typically don't need to call this API directly as the SDK handles checkpointing automatically.

Each checkpoint operation consumes the current checkpoint token and returns a new one for the next checkpoint. This ensures that checkpoints are applied in the correct order and prevents duplicate or out-of-order state updates.

Method Signature

METHODS /AWS1/IF_LMD~CHECKPOINTDURABLEEXECUTION
  IMPORTING
    !IV_DURABLEEXECUTIONARN TYPE /AWS1/LMDDURABLEEXECUTIONARN OPTIONAL
    !IV_CHECKPOINTTOKEN TYPE /AWS1/LMDCHECKPOINTTOKEN OPTIONAL
    !IT_UPDATES TYPE /AWS1/CL_LMDOPERATIONUPDATE=>TT_OPERATIONUPDATES OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/LMDCLIENTTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_lmdchkptdurableexersp
  RAISING
    /AWS1/CX_LMDINVPARAMVALUEEX
    /AWS1/CX_LMDSERVICEEXCEPTION
    /AWS1/CX_LMDTOOMANYREQUESTSEX
    /AWS1/CX_LMDCLIENTEXC
    /AWS1/CX_LMDSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_durableexecutionarn TYPE /AWS1/LMDDURABLEEXECUTIONARN /AWS1/LMDDURABLEEXECUTIONARN

The Amazon Resource Name (ARN) of the durable execution.

iv_checkpointtoken TYPE /AWS1/LMDCHECKPOINTTOKEN /AWS1/LMDCHECKPOINTTOKEN

A unique token that identifies the current checkpoint state. This token is provided by the Lambda runtime and must be used to ensure checkpoints are applied in the correct order. Each checkpoint operation consumes this token and returns a new one.

Optional arguments:

it_updates TYPE /AWS1/CL_LMDOPERATIONUPDATE=>TT_OPERATIONUPDATES TT_OPERATIONUPDATES

An array of state updates to apply during this checkpoint. Each update represents a change to the execution state, such as completing a step, starting a callback, or scheduling a timer. Updates are applied atomically as part of the checkpoint operation.

iv_clienttoken TYPE /AWS1/LMDCLIENTTOKEN /AWS1/LMDCLIENTTOKEN

An optional idempotency token to ensure that duplicate checkpoint requests are handled correctly. If provided, Lambda uses this token to detect and handle duplicate requests within a 15-minute window.

RETURNING

oo_output TYPE REF TO /aws1/cl_lmdchkptdurableexersp /AWS1/CL_LMDCHKPTDURABLEEXERSP

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->checkpointdurableexecution(
  it_updates = VALUE /aws1/cl_lmdoperationupdate=>tt_operationupdates(
    (
      new /aws1/cl_lmdoperationupdate(
        io_callbackoptions = new /aws1/cl_lmdcallbackoptions(
          iv_heartbeattimeoutseconds = 123
          iv_timeoutseconds = 123
        )
        io_chainedinvokeoptions = new /aws1/cl_lmdchainedinvokeopts(
          iv_functionname = |string|
          iv_tenantid = |string|
        )
        io_contextoptions = new /aws1/cl_lmdcontextoptions( ABAP_TRUE )
        io_error = new /aws1/cl_lmderrorobject(
          it_stacktrace = VALUE /aws1/cl_lmdstacktraceentrie00=>tt_stacktraceentries(
            ( new /aws1/cl_lmdstacktraceentrie00( |string| ) )
          )
          iv_errordata = |string|
          iv_errormessage = |string|
          iv_errortype = |string|
        )
        io_stepoptions = new /aws1/cl_lmdstepoptions( 123 )
        io_waitoptions = new /aws1/cl_lmdwaitoptions( 123 )
        iv_action = |string|
        iv_id = |string|
        iv_name = |string|
        iv_parentid = |string|
        iv_payload = |string|
        iv_subtype = |string|
        iv_type = |string|
      )
    )
  )
  iv_checkpointtoken = |string|
  iv_clienttoken = |string|
  iv_durableexecutionarn = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_checkpointtoken = lo_result->get_checkpointtoken( ).
  lo_checkpointupdatedexecut = lo_result->get_newexecutionstate( ).
  IF lo_checkpointupdatedexecut IS NOT INITIAL.
    LOOP AT lo_checkpointupdatedexecut->get_operations( ) into lo_row.
      lo_row_1 = lo_row.
      IF lo_row_1 IS NOT INITIAL.
        lv_operationid = lo_row_1->get_id( ).
        lv_operationid = lo_row_1->get_parentid( ).
        lv_operationname = lo_row_1->get_name( ).
        lv_operationtype = lo_row_1->get_type( ).
        lv_operationsubtype = lo_row_1->get_subtype( ).
        lv_executiontimestamp = lo_row_1->get_starttimestamp( ).
        lv_executiontimestamp = lo_row_1->get_endtimestamp( ).
        lv_operationstatus = lo_row_1->get_status( ).
        lo_executiondetails = lo_row_1->get_executiondetails( ).
        IF lo_executiondetails IS NOT INITIAL.
          lv_inputpayload = lo_executiondetails->get_inputpayload( ).
        ENDIF.
        lo_contextdetails = lo_row_1->get_contextdetails( ).
        IF lo_contextdetails IS NOT INITIAL.
          lv_replaychildren = lo_contextdetails->get_replaychildren( ).
          lv_operationpayload = lo_contextdetails->get_result( ).
          lo_errorobject = lo_contextdetails->get_error( ).
          IF lo_errorobject IS NOT INITIAL.
            lv_errormessage = lo_errorobject->get_errormessage( ).
            lv_errortype = lo_errorobject->get_errortype( ).
            lv_errordata = lo_errorobject->get_errordata( ).
            LOOP AT lo_errorobject->get_stacktrace( ) into lo_row_2.
              lo_row_3 = lo_row_2.
              IF lo_row_3 IS NOT INITIAL.
                lv_stacktraceentry = lo_row_3->get_value( ).
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
        lo_stepdetails = lo_row_1->get_stepdetails( ).
        IF lo_stepdetails IS NOT INITIAL.
          lv_attemptcount = lo_stepdetails->get_attempt( ).
          lv_executiontimestamp = lo_stepdetails->get_nextattempttimestamp( ).
          lv_operationpayload = lo_stepdetails->get_result( ).
          lo_errorobject = lo_stepdetails->get_error( ).
          IF lo_errorobject IS NOT INITIAL.
            lv_errormessage = lo_errorobject->get_errormessage( ).
            lv_errortype = lo_errorobject->get_errortype( ).
            lv_errordata = lo_errorobject->get_errordata( ).
            LOOP AT lo_errorobject->get_stacktrace( ) into lo_row_2.
              lo_row_3 = lo_row_2.
              IF lo_row_3 IS NOT INITIAL.
                lv_stacktraceentry = lo_row_3->get_value( ).
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
        lo_waitdetails = lo_row_1->get_waitdetails( ).
        IF lo_waitdetails IS NOT INITIAL.
          lv_executiontimestamp = lo_waitdetails->get_scheduledendtimestamp( ).
        ENDIF.
        lo_callbackdetails = lo_row_1->get_callbackdetails( ).
        IF lo_callbackdetails IS NOT INITIAL.
          lv_callbackid = lo_callbackdetails->get_callbackid( ).
          lv_operationpayload = lo_callbackdetails->get_result( ).
          lo_errorobject = lo_callbackdetails->get_error( ).
          IF lo_errorobject IS NOT INITIAL.
            lv_errormessage = lo_errorobject->get_errormessage( ).
            lv_errortype = lo_errorobject->get_errortype( ).
            lv_errordata = lo_errorobject->get_errordata( ).
            LOOP AT lo_errorobject->get_stacktrace( ) into lo_row_2.
              lo_row_3 = lo_row_2.
              IF lo_row_3 IS NOT INITIAL.
                lv_stacktraceentry = lo_row_3->get_value( ).
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
        lo_chainedinvokedetails = lo_row_1->get_chainedinvokedetails( ).
        IF lo_chainedinvokedetails IS NOT INITIAL.
          lv_operationpayload = lo_chainedinvokedetails->get_result( ).
          lo_errorobject = lo_chainedinvokedetails->get_error( ).
          IF lo_errorobject IS NOT INITIAL.
            lv_errormessage = lo_errorobject->get_errormessage( ).
            lv_errortype = lo_errorobject->get_errortype( ).
            lv_errordata = lo_errorobject->get_errordata( ).
            LOOP AT lo_errorobject->get_stacktrace( ) into lo_row_2.
              lo_row_3 = lo_row_2.
              IF lo_row_3 IS NOT INITIAL.
                lv_stacktraceentry = lo_row_3->get_value( ).
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDLOOP.
    lv_string = lo_checkpointupdatedexecut->get_nextmarker( ).
  ENDIF.
ENDIF.