Class BeamFnDataGrpcMultiplexer
- All Implemented Interfaces:
AutoCloseable
Endpoints.ApiServiceDescriptor.
Multiplexes data for inbound consumers based upon their instructionId.
Multiplexing inbound and outbound streams is as thread safe as the consumers of those streams. For inbound streams, this is as thread safe as the inbound observers. For outbound streams, this is as thread safe as the underlying stream observer.
TODO: Add support for multiplexing over multiple outbound observers by stickying the output location with a specific outbound observer.
-
Constructor Summary
ConstructorsConstructorDescriptionBeamFnDataGrpcMultiplexer(@Nullable org.apache.beam.model.pipeline.v1.Endpoints.ApiServiceDescriptor apiServiceDescriptor, OutboundObserverFactory outboundObserverFactory, OutboundObserverFactory.BasicFactory<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements, org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> baseOutboundObserverFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> voidpoisonInstructionId(String instructionId) Poisons an instruction id.voidregisterConsumer(String instructionId, CloseableFnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> receiver) Registers a consumer for the specified instruction id.toString()voidunregisterConsumer(String instructionId) Unregisters a previously registered consumer.
-
Constructor Details
-
BeamFnDataGrpcMultiplexer
public BeamFnDataGrpcMultiplexer(@Nullable org.apache.beam.model.pipeline.v1.Endpoints.ApiServiceDescriptor apiServiceDescriptor, OutboundObserverFactory outboundObserverFactory, OutboundObserverFactory.BasicFactory<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements, org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> baseOutboundObserverFactory)
-
-
Method Details
-
toString
-
getInboundObserver
public org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> getInboundObserver() -
getOutboundObserver
public org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> getOutboundObserver() -
registerConsumer
public void registerConsumer(String instructionId, CloseableFnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> receiver) Registers a consumer for the specified instruction id.The
BeamFnDataGrpcMultiplexerpartitionsBeamFnApi.Elementswith multiple instruction ids ensuring that the receiver will only seeBeamFnApi.Elementswith a single instruction id.The caller must either
unregister the consumerwhen all messages have been processed orpoison the instructionif messages for the instruction should be dropped. -
unregisterConsumer
Unregisters a previously registered consumer. -
poisonInstructionId
Poisons an instruction id.Any records for the instruction on the inbound observer will be dropped for the next
POISONED_INSTRUCTION_ID_CACHE_TIMEOUT. -
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-