public class BeamFnDataGrpcMultiplexer2
extends java.lang.Object
implements java.lang.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 and Description |
---|
BeamFnDataGrpcMultiplexer2(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) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
org.apache.beam.vendor.grpc.v1p43p2.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> |
getInboundObserver() |
org.apache.beam.vendor.grpc.v1p43p2.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> |
getOutboundObserver() |
void |
registerConsumer(java.lang.String instructionId,
CloseableFnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> receiver)
Registers a consumer for the specified intruction id.
|
java.lang.String |
toString() |
void |
unregisterConsumer(java.lang.String instructionId)
Unregisters a consumer.
|
public BeamFnDataGrpcMultiplexer2(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)
public java.lang.String toString()
toString
in class java.lang.Object
public org.apache.beam.vendor.grpc.v1p43p2.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> getInboundObserver()
public org.apache.beam.vendor.grpc.v1p43p2.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> getOutboundObserver()
public void registerConsumer(java.lang.String instructionId, CloseableFnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> receiver)
The BeamFnDataGrpcMultiplexer2
partitions BeamFnApi.Elements
with multiple
instruction ids ensuring that the receiver will only see BeamFnApi.Elements
with a
single instruction id.
The caller must unregister the consumer
when they no longer wish
to receive messages.
public void unregisterConsumer(java.lang.String instructionId)
public void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception