ibzib commented on a change in pull request #11932:
URL: https://github.com/apache/beam/pull/11932#discussion_r436178918
##########
File path:
runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/artifact/ArtifactRetrievalService.java
##########
@@ -89,34 +92,41 @@ public void resolveArtifacts(
public void getArtifact(
ArtifactApi.GetArtifactRequest request,
StreamObserver<ArtifactApi.GetArtifactResponse> responseObserver) {
- switch (request.getArtifact().getTypeUrn()) {
+ try {
+ InputStream inputStream = getArtifact(request.getArtifact());
+ byte[] buffer = new byte[bufferSize];
+ int bytesRead;
+ while ((bytesRead = inputStream.read(buffer)) > 0) {
+ responseObserver.onNext(
+ ArtifactApi.GetArtifactResponse.newBuilder()
+ .setData(ByteString.copyFrom(buffer, 0, bytesRead))
+ .build());
+ }
+ responseObserver.onCompleted();
+ } catch (IOException exn) {
+ exn.printStackTrace();
+ responseObserver.onError(exn);
Review comment:
Should we have wrapped this exception in a StatusException as well?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]