Class BasePersistenceStore
java.lang.Object
software.amazon.lambda.powertools.idempotency.persistence.BasePersistenceStore
- All Implemented Interfaces:
PersistenceStore
Persistence layer that will store the idempotency result.
Base implementation. See
for an implementation (default one)
Extends this class to use your own implementation (DocumentDB, Elasticache, ...)
invalid reference
DynamoDBPersistenceStore
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(IdempotencyConfig config, String functionName) Initialize the base persistence layer from the configuration settingsvoiddeleteRecord(com.fasterxml.jackson.databind.JsonNode data, Throwable throwable) Delete record from the persistence storeRetrieve idempotency key for data provided, fetch from persistence store, and convert to DataRecord.voidsaveInProgress(com.fasterxml.jackson.databind.JsonNode data, Instant now, OptionalInt remainingTimeInMs) Save record of function's execution being in progressvoidsaveSuccess(com.fasterxml.jackson.databind.JsonNode data, Object result, Instant now) Save record of function's execution completing successfullyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.lambda.powertools.idempotency.persistence.PersistenceStore
deleteRecord, getRecord, putRecord, updateRecord
-
Field Details
-
payloadValidationEnabled
protected boolean payloadValidationEnabled
-
-
Constructor Details
-
BasePersistenceStore
public BasePersistenceStore()
-
-
Method Details
-
configure
Initialize the base persistence layer from the configuration settings- Parameters:
config- Idempotency configuration settingsfunctionName- The name of the function being decorated
-
saveSuccess
Save record of function's execution completing successfully- Parameters:
data- Payloadresult- the response from the function
-
saveInProgress
public void saveInProgress(com.fasterxml.jackson.databind.JsonNode data, Instant now, OptionalInt remainingTimeInMs) throws IdempotencyItemAlreadyExistsException Save record of function's execution being in progress- Parameters:
data- Payloadnow-- Throws:
IdempotencyItemAlreadyExistsException
-
deleteRecord
Delete record from the persistence store- Parameters:
data- Payloadthrowable- The throwable thrown by the function
-
getRecord
public DataRecord getRecord(com.fasterxml.jackson.databind.JsonNode data, Instant now) throws IdempotencyValidationException, IdempotencyItemNotFoundException Retrieve idempotency key for data provided, fetch from persistence store, and convert to DataRecord.- Parameters:
data- Payload- Returns:
- DataRecord representation of existing record found in persistence store
- Throws:
IdempotencyValidationException- Payload doesn't match the stored record for the given idempotency keyIdempotencyItemNotFoundException- Exception thrown if no record exists in persistence store with the idempotency key
-