m-trieu commented on code in PR #34148:
URL: https://github.com/apache/beam/pull/34148#discussion_r2009265938


##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/streaming/harness/FanOutStreamingEngineWorkerHarness.java:
##########
@@ -127,7 +141,13 @@ private FanOutStreamingEngineWorkerHarness(
       GrpcDispatcherClient dispatcherClient,
       Function<WindmillStream.CommitWorkStream, WorkCommitter> 
workCommitterFactory,
       ThrottlingGetDataMetricTracker getDataMetricTracker,
-      ExecutorService workerMetadataConsumer) {
+      ExecutorService workerMetadataConsumer,

Review Comment:
   instead of passing all of these in can the constructor take in a 
   `Function<WindmillConnection, WindmillStreamSender> 
windmillStreamPoolSenderFactory`
   
   or create a WindmillStreamPoolSenderFactory.java interface
   
   ```
   @FunctionalInterface
   interface WindmillStreamPoolSenderFactory {
     WindmillStreamSender create(WindmillConnection connection);
   }
   ```
   
   then in `StreamingDataflowWorker.java` you can pass in
   ```
   connection -> WindmillStreamPoolSender.create(
                   connection,
                   GetWorkRequest.newBuilder()
                       .setClientId(jobHeader.getClientId())
                       .setJobId(jobHeader.getJobId())
                       .setProjectId(jobHeader.getProjectId())
                       .setWorkerId(jobHeader.getWorkerId())
                       .setMaxItems(totalGetWorkBudget.items())
                       .setMaxBytes(totalGetWorkBudget.bytes())
                       .build(),
                   GetWorkBudget.noBudget(),
                   streamFactory,
                   streamPoolWorkCommitter,
                   streamPoolGetDataClient,
                   streamPoolHeartbeatSender,
                   streamingWorkScheduler,
                   waitForResources,
                   computationStateFetcher)
   ```
   
   and in `createAndStartWindmillStreamSender`
   
   you can call `windmillStreamPoolSenderFactory.create()` / 
`windmillStreamPoolSenderFactory.apply(connection)`
   
   since it seems like all of those params are just added to create the 
WindmillStreamPoolSender



-- 
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.

To unsubscribe, e-mail: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to