Package org.apache.beam.sdk.fn.data
Class BeamFnDataGrpcMultiplexer2
- java.lang.Object
-
- org.apache.beam.sdk.fn.data.BeamFnDataGrpcMultiplexer2
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class BeamFnDataGrpcMultiplexer2 extends java.lang.Object implements java.lang.AutoCloseableA gRPC multiplexer for a specificEndpoints.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
Constructors Constructor Description BeamFnDataGrpcMultiplexer2(@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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()org.apache.beam.vendor.grpc.v1p48p1.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements>getInboundObserver()org.apache.beam.vendor.grpc.v1p48p1.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements>getOutboundObserver()voidregisterConsumer(java.lang.String instructionId, CloseableFnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> receiver)Registers a consumer for the specified intruction id.java.lang.StringtoString()voidunregisterConsumer(java.lang.String instructionId)Unregisters a consumer.
-
-
-
Constructor Detail
-
BeamFnDataGrpcMultiplexer2
public BeamFnDataGrpcMultiplexer2(@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 Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getInboundObserver
public org.apache.beam.vendor.grpc.v1p48p1.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> getInboundObserver()
-
getOutboundObserver
public org.apache.beam.vendor.grpc.v1p48p1.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> getOutboundObserver()
-
registerConsumer
public void registerConsumer(java.lang.String instructionId, CloseableFnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> receiver)Registers a consumer for the specified intruction id.The
BeamFnDataGrpcMultiplexer2partitionsBeamFnApi.Elementswith multiple instruction ids ensuring that the receiver will only seeBeamFnApi.Elementswith a single instruction id.The caller must
unregister the consumerwhen they no longer wish to receive messages.
-
unregisterConsumer
public void unregisterConsumer(java.lang.String instructionId)
Unregisters a consumer.
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
-