private S3Wrapper(final InternalEvent internal) { S3InternalEvent s3Event = ((S3InternalEvent) internal); this.s3Key = s3Event.getS3Key(); this.s3Bucket = s3Event.getS3Bucket(); this.s3KeyVersion = s3Event.getS3KeyVersion(); this.functionName = internal.getCtx().getContext().getFunctionName(); this.functionVersion = internal.getCtx().getContext().getFunctionVersion(); this.processingTime = System.currentTimeMillis(); this.timestamp = internal.getEventTime(); this.processingDelay = processingTime - timestamp; this.sha1Hash = internal.getEventSha1Hash(); if (internal.getEventObj() != null) { this.payload = internal.getEventObj().getPayload(); } else { this.payload = null; } }
@Override public InternalEvent next() { updateCursor(); /* * Wrap reading next row in retry logic. This is because there is intermittent socket timeouts * when reading from S3 that cause the function to hang/fail. */ Callable<String> callable = () -> { return this.lineIterator.next(); }; String nextRow; try { CallResults<Object> results = new CallExecutor(this.config).execute(callable); nextRow = (String) results.getResult(); } catch (RetriesExhaustedException ree) { throw new RuntimeException(ree.getCallResults().getLastExceptionThatCausedRetry()); } catch (UnexpectedException ue) { throw ue; } /* * Construct the internal event */ return new S3InternalEvent(nextRow, this.context, this.arrivalTime, currentS3Entity.getObject().getKey(), currentS3Entity.getBucket().getName(), currentS3Entity.getObject().getVersionId()); }
@Override public InternalEvent next() { updateCursor(); /* * Wrap reading next row in retry logic. This is because there is intermittent socket timeouts * when reading from S3 that cause the function to hang/fail. */ Callable<String> callable = () -> { return this.lineIterator.next(); }; String nextRow; try { CallResults<Object> results = new CallExecutor(this.config).execute(callable); nextRow = (String) results.getResult(); } catch (RetriesExhaustedException ree) { throw new RuntimeException(ree.getCallResults().getLastExceptionThatCausedRetry()); } catch (UnexpectedException ue) { throw ue; } /* * Construct the internal event */ return new S3InternalEvent(nextRow, this.context, this.arrivalTime, currentS3Entity.getObject().getKey(), currentS3Entity.getBucket().getName(), currentS3Entity.getObject().getVersionId()); }
private S3Wrapper(final InternalEvent internal) { S3InternalEvent s3Event = ((S3InternalEvent) internal); this.s3Key = s3Event.getS3Key(); this.s3Bucket = s3Event.getS3Bucket(); this.s3KeyVersion = s3Event.getS3KeyVersion(); this.functionName = internal.getCtx().getContext().getFunctionName(); this.functionVersion = internal.getCtx().getContext().getFunctionVersion(); this.processingTime = System.currentTimeMillis(); this.timestamp = internal.getEventTime(); this.processingDelay = processingTime - timestamp; this.sha1Hash = internal.getEventSha1Hash(); if (internal.getEventObj() != null) { this.payload = internal.getEventObj().getPayload(); } else { this.payload = null; } }