public class BeamFnDataInboundObserver<T> extends java.lang.Object implements java.util.function.BiConsumer<org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString,java.lang.Boolean>, InboundDataClient
ByteString
s with the provided Coder
passing the
individual decoded elements to the provided consumer.Constructor and Description |
---|
BeamFnDataInboundObserver(LogicalEndpoint endpoint,
Coder<T> coder,
FnDataReceiver<T> consumer,
InboundDataClient readFuture) |
Modifier and Type | Method and Description |
---|---|
void |
accept(org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString payload,
java.lang.Boolean isLast) |
void |
awaitCompletion()
Block until the client has completed reading from the inbound stream.
|
void |
cancel()
Cancels the client, causing it to drop any future inbound data.
|
void |
complete()
Mark the client as completed.
|
void |
fail(java.lang.Throwable t)
Mark the client as completed with an exception.
|
static <T> BeamFnDataInboundObserver<T> |
forConsumer(LogicalEndpoint endpoint,
Coder<T> coder,
FnDataReceiver<T> receiver) |
boolean |
isDone()
Returns true if the client is done, either via completing successfully or by being cancelled.
|
public BeamFnDataInboundObserver(LogicalEndpoint endpoint, Coder<T> coder, FnDataReceiver<T> consumer, InboundDataClient readFuture)
public static <T> BeamFnDataInboundObserver<T> forConsumer(LogicalEndpoint endpoint, Coder<T> coder, FnDataReceiver<T> receiver)
public void accept(org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString payload, java.lang.Boolean isLast)
accept
in interface java.util.function.BiConsumer<org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString,java.lang.Boolean>
public void awaitCompletion() throws java.lang.Exception
InboundDataClient
awaitCompletion
in interface InboundDataClient
java.lang.InterruptedException
- if the client is interrupted before completing.java.util.concurrent.CancellationException
- if the client is cancelled before completing.java.lang.Exception
- if the client throws an exception while awaiting completion.public boolean isDone()
InboundDataClient
isDone
in interface InboundDataClient
public void cancel()
InboundDataClient
cancel
in interface InboundDataClient
public void complete()
InboundDataClient
complete
in interface InboundDataClient
public void fail(java.lang.Throwable t)
InboundDataClient
fail
in interface InboundDataClient
t
- the throwable that caused this client to fail