Search in sources :

Example 1 with ControlClientPool

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());
}
Also used : FnApiControlClientPoolService(org.apache.beam.runners.fnexecution.control.FnApiControlClientPoolService) InProcessServerFactory(org.apache.beam.sdk.fn.server.InProcessServerFactory) MapControlClientPool(org.apache.beam.runners.fnexecution.control.MapControlClientPool) ControlClientPool(org.apache.beam.runners.fnexecution.control.ControlClientPool) ThreadFactoryBuilder(org.apache.beam.vendor.guava.v26_0_jre.com.google.common.util.concurrent.ThreadFactoryBuilder) InstructionRequestHandler(org.apache.beam.runners.fnexecution.control.InstructionRequestHandler)

Aggregations

ControlClientPool (org.apache.beam.runners.fnexecution.control.ControlClientPool)1 FnApiControlClientPoolService (org.apache.beam.runners.fnexecution.control.FnApiControlClientPoolService)1 InstructionRequestHandler (org.apache.beam.runners.fnexecution.control.InstructionRequestHandler)1 MapControlClientPool (org.apache.beam.runners.fnexecution.control.MapControlClientPool)1 InProcessServerFactory (org.apache.beam.sdk.fn.server.InProcessServerFactory)1 ThreadFactoryBuilder (org.apache.beam.vendor.guava.v26_0_jre.com.google.common.util.concurrent.ThreadFactoryBuilder)1