use of org.apache.beam.runners.fnexecution.control.ControlClientPool in project beam by apache.
the class EmbeddedSdkHarness method before.
@Override
protected void before() throws Exception {
InProcessServerFactory serverFactory = InProcessServerFactory.create();
executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setDaemon(true).build());
ControlClientPool clientPool = MapControlClientPool.create();
FnApiControlClientPoolService clientPoolService = FnApiControlClientPoolService.offeringClientsToPool(clientPool.getSink(), GrpcContextHeaderAccessorProvider.getHeaderAccessor());
loggingServer = GrpcFnServer.allocatePortAndCreateFor(GrpcLoggingService.forWriter(Slf4jLogWriter.getDefault()), serverFactory);
dataServer = GrpcFnServer.allocatePortAndCreateFor(GrpcDataService.create(PipelineOptionsFactory.create(), executor, OutboundObserverFactory.serverDirect()), serverFactory);
controlServer = GrpcFnServer.allocatePortAndCreateFor(clientPoolService, serverFactory);
InstructionRequestHandler requestHandler = EmbeddedEnvironmentFactory.create(PipelineOptionsFactory.create(), loggingServer, controlServer, clientPool.getSource()).createEnvironment(Environment.getDefaultInstance(), "embedded_worker").getInstructionRequestHandler();
client = SdkHarnessClient.usingFnApiClient(requestHandler, dataServer.getService());
}
Aggregations