Skip to content

Commit 950ee64

Browse files
lavaleriHanniganLeeroyHannigan
authored
fix: Add consistent read to basic example (#298)
* Changed type to N and added consistent read to true * Update Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/BasicPutGetExample.java Co-authored-by: lavaleri <[email protected]> --------- Co-authored-by: Hannigan <[email protected]> Co-authored-by: Lee <[email protected]>
1 parent 5cc8337 commit 950ee64

File tree

1 file changed

+7
-1
lines changed
  • Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples

1 file changed

+7
-1
lines changed

Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/BasicPutGetExample.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
This table must be configured with the following
2828
primary key configuration:
2929
- Partition key is named "partition_key" with type (S)
30-
- Sort key is named "sort_key" with type (S)
30+
- Sort key is named "sort_key" with type (N)
3131
*/
3232
public class BasicPutGetExample {
3333

@@ -154,6 +154,12 @@ public static void PutItemGetItem(String kmsKeyId, String ddbTableName) {
154154
final GetItemRequest getRequest = GetItemRequest.builder()
155155
.key(keyToGet)
156156
.tableName(ddbTableName)
157+
// In this example we configure a strongly consistent read
158+
// because we perform a read immediately after a write (for demonstrative purposes).
159+
// By default, reads are only eventually consistent.
160+
// Read our docs to determine which read consistency to use for your application:
161+
// https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html
162+
.consistentRead(Boolean.TRUE)
157163
.build();
158164

159165
final GetItemResponse getResponse = ddb.getItem(getRequest);

0 commit comments

Comments
 (0)