in Java/src/main/java/com/example/customername/Ingest.java [44:83]
private void putRecordsIntoFG(List < FeatureValue > featuresList) {
// Create timestamp EventTime feature definition
String timestamp = FeatureGroupRecordOperations.getStringTimeStamp();
FeatureValue timeStampFeature = FeatureValue.builder()
.featureName(_eventTimeName)
.valueAsString(timestamp)
.build();
// Add EventTime timestamp to features list of the row
// This is done here to give proper current time for DynamoDB to reference
featuresList.add(timeStampFeature);
//Calling the put record API
PutRecordRequest putRecordRequest = PutRecordRequest.builder()
.featureGroupName(_featureGroupName)
.record(featuresList)
.build();
// Put record into FG
boolean isSuccess = false;
boolean isRetry = false;
do {
try {
long startTime = System.nanoTime();
_sageMakerFeatureStoreRuntimeClient.putRecord(putRecordRequest);
_ingestMetrics.addInterval(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime));
} catch(Exception e){
System.out.println(String.format("\nThread: %1$s, Amazon error: %2$s", this.getName(), e));
isRetry = true;
continue;
}
if (isRetry){
System.out.println(String.format("\n%1$s preveiled!", this.getName()));
isRetry = false;
}
isSuccess = true;
} while(isSuccess == false);
}