public static class IdempotencyConfig.Builder
extends java.lang.Object
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
IdempotencyConfig |
build()
|
IdempotencyConfig.Builder |
withEventKeyJMESPath(java.lang.String eventKeyJMESPath)
A JMESPath expression to extract the idempotency key from the event record.
|
IdempotencyConfig.Builder |
withExpiration(java.time.Duration expiration)
The number of seconds to wait before a record is expired
|
IdempotencyConfig.Builder |
withHashFunction(java.lang.String hashFunction)
Function to use for calculating hashes, by default MD5.
|
IdempotencyConfig.Builder |
withLocalCacheMaxItems(int localCacheMaxItems)
Set the maximum number of items to store in local cache, by default 256
|
IdempotencyConfig.Builder |
withPayloadValidationJMESPath(java.lang.String payloadValidationJMESPath)
A JMESPath expression to extract the payload to be validated from the event record.
|
IdempotencyConfig.Builder |
withThrowOnNoIdempotencyKey()
Throw an exception if no idempotency key was found in the request.
|
IdempotencyConfig.Builder |
withThrowOnNoIdempotencyKey(boolean throwOnNoIdempotencyKey)
Whether to throw an exception if no idempotency key was found in the request, by default false
|
IdempotencyConfig.Builder |
withUseLocalCache(boolean useLocalCache)
Whether to locally cache idempotency results, by default false
|
public IdempotencyConfig build()
IdempotencyConfig.IdempotencyConfig.builder().withUseLocalCache().build();This instance must then be passed to the
Idempotency.Config:
Idempotency.config().withConfig(config).configure();
IdempotencyConfig.public IdempotencyConfig.Builder withEventKeyJMESPath(java.lang.String eventKeyJMESPath)
powertools_json(body) for APIGatewayProxyRequestEvent and APIGatewayV2HTTPEventRecords[*].powertools_json(body) for SQSEventRecords[0].Sns.Message | powertools_json(@) for SNSEventdetail for ScheduledEvent (EventBridge / CloudWatch events)Records[*].kinesis.powertools_json(powertools_base64(data)) for KinesisEventRecords[*].powertools_json(powertools_base64(data)) for KinesisFirehoseEventeventKeyJMESPath - path of the key in the Lambda eventpublic IdempotencyConfig.Builder withLocalCacheMaxItems(int localCacheMaxItems)
localCacheMaxItems - maximum number of items to store in local cachepublic IdempotencyConfig.Builder withUseLocalCache(boolean useLocalCache)
useLocalCache - boolean that indicate if a local cache must be used in addition to the persistence store.
If set to true, will use the LRUCachepublic IdempotencyConfig.Builder withExpiration(java.time.Duration expiration)
expiration - expiration of the record in the storepublic IdempotencyConfig.Builder withPayloadValidationJMESPath(java.lang.String payloadValidationJMESPath)
payloadValidationJMESPath - JMES Path of a part of the payload to be used for validationpublic IdempotencyConfig.Builder withThrowOnNoIdempotencyKey(boolean throwOnNoIdempotencyKey)
throwOnNoIdempotencyKey - boolean to indicate if we must throw an Exception when
idempotency key could not be found in the payload.public IdempotencyConfig.Builder withThrowOnNoIdempotencyKey()
withThrowOnNoIdempotencyKey(boolean), forced as truepublic IdempotencyConfig.Builder withHashFunction(java.lang.String hashFunction)
hashFunction - Can be any algorithm supported by MessageDigest, most commons areCopyright © 2023. All rights reserved.