Class FnApiControlClient
java.lang.Object
org.apache.beam.runners.fnexecution.control.FnApiControlClient
- All Implemented Interfaces:
Closeable
,AutoCloseable
,InstructionRequestHandler
A client for the control plane of an SDK harness, which can issue requests to it over the Fn API.
This class presents a low-level Java API de-inverting the Fn API's gRPC layer.
The Fn API is inverted so the runner is the server and the SDK harness is the client, for firewalling reasons (the runner may execute in a more privileged environment forbidding outbound connections).
This low-level client is responsible only for correlating requests with responses.
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver
<org.apache.beam.model.fnexecution.v1.BeamFnApi.InstructionResponse> void
close()
static FnApiControlClient
forRequestObserver
(String workerId, org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.InstructionRequest> requestObserver, ConcurrentMap<String, org.apache.beam.model.fnexecution.v1.BeamFnApi.ProcessBundleDescriptor> processBundleDescriptors) Returns aFnApiControlClient
which will submit its requests to the provided observer.org.apache.beam.model.fnexecution.v1.BeamFnApi.ProcessBundleDescriptor
CompletionStage
<org.apache.beam.model.fnexecution.v1.BeamFnApi.InstructionResponse> handle
(org.apache.beam.model.fnexecution.v1.BeamFnApi.InstructionRequest request) void
onClose
(Consumer<FnApiControlClient> onCloseListener) void
registerProcessBundleDescriptor
(org.apache.beam.model.fnexecution.v1.BeamFnApi.ProcessBundleDescriptor processBundleDescriptor)
-
Method Details
-
forRequestObserver
public static FnApiControlClient forRequestObserver(String workerId, org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.InstructionRequest> requestObserver, ConcurrentMap<String, org.apache.beam.model.fnexecution.v1.BeamFnApi.ProcessBundleDescriptor> processBundleDescriptors) Returns aFnApiControlClient
which will submit its requests to the provided observer.It is the responsibility of the caller to register this object as an observer of incoming responses (this will generally be done as part of fulfilling the contract of a gRPC service).
-
handle
public CompletionStage<org.apache.beam.model.fnexecution.v1.BeamFnApi.InstructionResponse> handle(org.apache.beam.model.fnexecution.v1.BeamFnApi.InstructionRequest request) - Specified by:
handle
in interfaceInstructionRequestHandler
-
asResponseObserver
public org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.InstructionResponse> asResponseObserver() -
getProcessBundleDescriptor
public org.apache.beam.model.fnexecution.v1.BeamFnApi.ProcessBundleDescriptor getProcessBundleDescriptor(String id) -
registerProcessBundleDescriptor
public void registerProcessBundleDescriptor(org.apache.beam.model.fnexecution.v1.BeamFnApi.ProcessBundleDescriptor processBundleDescriptor) - Specified by:
registerProcessBundleDescriptor
in interfaceInstructionRequestHandler
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getWorkerId
-
onClose
-