in src/main/java/com/amazonaws/kinesisvideo/parser/utilities/DynamoDBHelper.java [185:211]
public void updateItem(final String streamName, final String fragmentNumber,
final Long producerTime, final Long serverTime, final Long updatedTime) {
try {
final Map<String,AttributeValue> key = new HashMap<>();
key.put(KVS_STREAM_NAME, new AttributeValue().withS(streamName));
final Map<String,AttributeValueUpdate> updates = new HashMap<>();
updates.put(FRAGMENT_NUMBER, new AttributeValueUpdate().withValue(
new AttributeValue().withS(fragmentNumber)));
updates.put(UPDATED_TIME, new AttributeValueUpdate().withValue(
new AttributeValue().withN(updatedTime.toString())));
updates.put(PRODUCER_TIME, new AttributeValueUpdate().withValue(
new AttributeValue().withN(producerTime.toString())));
updates.put(SERVER_TIME, new AttributeValueUpdate().withValue(
new AttributeValue().withN(serverTime.toString())));
final UpdateItemRequest updateItemRequest = new UpdateItemRequest()
{{
setTableName(TABLE_NAME);
setKey(key);
setAttributeUpdates(updates);
}};
final UpdateItemResult result = ddbClient.updateItem(updateItemRequest);
log.info("Item updated : {}", result.getAttributes());
} catch (final Exception e) {
log.warn("Error while updating item in the table!", e);
}
}