Class DynamoDBPersistenceStore
java.lang.Object
software.amazon.lambda.powertools.idempotency.persistence.BasePersistenceStore
software.amazon.lambda.powertools.idempotency.persistence.dynamodb.DynamoDBPersistenceStore
- All Implemented Interfaces:
org.crac.Resource,software.amazon.lambda.powertools.idempotency.persistence.PersistenceStore
public final class DynamoDBPersistenceStore
extends software.amazon.lambda.powertools.idempotency.persistence.BasePersistenceStore
implements software.amazon.lambda.powertools.idempotency.persistence.PersistenceStore, org.crac.Resource
DynamoDB version of the
Use the
PersistenceStore. Will store idempotency data in DynamoDB.Use the
DynamoDBPersistenceStore.Builder to create a new instance.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classUse this builder to get an instance ofDynamoDBPersistenceStore.
With this builder you can configure the characteristics of the DynamoDB Table (name, key, sort key, and other field names).
You can also set a customDynamoDbClientfor further tuning. -
Field Summary
FieldsFields inherited from class software.amazon.lambda.powertools.idempotency.persistence.BasePersistenceStore
payloadValidationEnabled -
Method Summary
Modifier and TypeMethodDescriptionvoidafterRestore(org.crac.Context<? extends org.crac.Resource> context) voidbeforeCheckpoint(org.crac.Context<? extends org.crac.Resource> context) Primes the persistent store by invoking the get record method with a key that doesn't exist.builder()voiddeleteRecord(String idempotencyKey) software.amazon.lambda.powertools.idempotency.persistence.DataRecordvoidStore's the given idempotency record in the DDB store.voidupdateRecord(software.amazon.lambda.powertools.idempotency.persistence.DataRecord record) Methods inherited from class software.amazon.lambda.powertools.idempotency.persistence.BasePersistenceStore
configure, deleteRecord, getRecord, saveInProgress, saveSuccess
-
Field Details
-
IDEMPOTENCY
- See Also:
-
-
Method Details
-
beforeCheckpoint
public void beforeCheckpoint(org.crac.Context<? extends org.crac.Resource> context) throws Exception Primes the persistent store by invoking the get record method with a key that doesn't exist.- Specified by:
beforeCheckpointin interfaceorg.crac.Resource- Parameters:
context-- Throws:
Exception
-
afterRestore
- Specified by:
afterRestorein interfaceorg.crac.Resource- Throws:
Exception
-
builder
-
getRecord
public software.amazon.lambda.powertools.idempotency.persistence.DataRecord getRecord(String idempotencyKey) throws software.amazon.lambda.powertools.idempotency.exceptions.IdempotencyItemNotFoundException - Specified by:
getRecordin interfacesoftware.amazon.lambda.powertools.idempotency.persistence.PersistenceStore- Throws:
software.amazon.lambda.powertools.idempotency.exceptions.IdempotencyItemNotFoundException
-
putRecord
public void putRecord(software.amazon.lambda.powertools.idempotency.persistence.DataRecord record, Instant now) throws software.amazon.lambda.powertools.idempotency.exceptions.IdempotencyItemAlreadyExistsException Store's the given idempotency record in the DDB store. If there is an existing record that has expired - either due to the cache expiry or due to the in_progress_expiry - the record will be overwritten and the idempotent operation can continue. Note: This method writes only expiry and status information - not the results of the operation itself.- Specified by:
putRecordin interfacesoftware.amazon.lambda.powertools.idempotency.persistence.PersistenceStore- Parameters:
record- DataRecord instance to storenow-- Throws:
software.amazon.lambda.powertools.idempotency.exceptions.IdempotencyItemAlreadyExistsException
-
updateRecord
public void updateRecord(software.amazon.lambda.powertools.idempotency.persistence.DataRecord record) - Specified by:
updateRecordin interfacesoftware.amazon.lambda.powertools.idempotency.persistence.PersistenceStore
-
deleteRecord
- Specified by:
deleteRecordin interfacesoftware.amazon.lambda.powertools.idempotency.persistence.PersistenceStore
-