public class BeamFnDataBufferingOutboundObserver<T> extends java.lang.Object implements CloseableFnDataReceiver<org.apache.beam.sdk.util.WindowedValue<T>>
FnDataReceiver
for the Beam Fn Data API.
Encodes individually consumed elements with the provided Coder
producing a single
BeamFnApi.Elements
message when the buffer threshold is surpassed.
The default buffer threshold can be overridden by specifying the experiment beam_fn_api_data_buffer_limit=<bytes>
TODO: Handle outputting large elements (> 2GiBs). Note that this also applies to the input side as well.
TODO: Handle outputting elements that are zero bytes by outputting a single byte as a marker, detect on the input side that no bytes were read and force reading a single byte.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BEAM_FN_API_DATA_BUFFER_LIMIT |
Modifier and Type | Method and Description |
---|---|
void |
accept(org.apache.beam.sdk.util.WindowedValue<T> t) |
void |
close()
.
|
void |
flush()
Eagerly flushes any data that is buffered in this channel.
|
static <T> BeamFnDataBufferingOutboundObserver<T> |
forLocation(LogicalEndpoint endpoint,
Coder<org.apache.beam.sdk.util.WindowedValue<T>> coder,
org.apache.beam.vendor.grpc.v1_13_1.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> outboundObserver) |
static <T> BeamFnDataBufferingOutboundObserver<T> |
forLocationWithBufferLimit(int bufferLimit,
LogicalEndpoint endpoint,
Coder<org.apache.beam.sdk.util.WindowedValue<T>> coder,
org.apache.beam.vendor.grpc.v1_13_1.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> outboundObserver) |
public static final java.lang.String BEAM_FN_API_DATA_BUFFER_LIMIT
public static <T> BeamFnDataBufferingOutboundObserver<T> forLocation(LogicalEndpoint endpoint, Coder<org.apache.beam.sdk.util.WindowedValue<T>> coder, org.apache.beam.vendor.grpc.v1_13_1.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> outboundObserver)
public static <T> BeamFnDataBufferingOutboundObserver<T> forLocationWithBufferLimit(int bufferLimit, LogicalEndpoint endpoint, Coder<org.apache.beam.sdk.util.WindowedValue<T>> coder, org.apache.beam.vendor.grpc.v1_13_1.io.grpc.stub.StreamObserver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> outboundObserver)
public void close() throws java.lang.Exception
CloseableFnDataReceiver
Does nothing if this CloseableFnDataReceiver
is already closed.
close
in interface java.lang.AutoCloseable
close
in interface CloseableFnDataReceiver<org.apache.beam.sdk.util.WindowedValue<T>>
java.lang.Exception
public void flush() throws java.io.IOException
CloseableFnDataReceiver
flush
in interface CloseableFnDataReceiver<org.apache.beam.sdk.util.WindowedValue<T>>
java.io.IOException
public void accept(org.apache.beam.sdk.util.WindowedValue<T> t) throws java.io.IOException
accept
in interface FnDataReceiver<org.apache.beam.sdk.util.WindowedValue<T>>
java.io.IOException