public class BeamFnDataInboundObserver2 extends java.lang.Object implements CloseableFnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements>
BeamFnApi.Elements partitioning them using the provided DataEndpoints and
TimerEndpoints.
Note that this receiver uses a queue to buffer and pass elements from one thread to be
processed by the thread which invokes awaitCompletion().
Closing the receiver will unblock any upstream producer and downstream consumer exceptionally.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
BeamFnDataInboundObserver2.CloseException |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements elements) |
void |
awaitCompletion()
Uses the callers thread to process all elements received until we receive the end of the stream
from the upstream producer for all endpoints specified.
|
void |
close()
.
|
void |
flush()
Eagerly flushes any data that is buffered in this channel.
|
static BeamFnDataInboundObserver2 |
forConsumers(java.util.List<DataEndpoint<?>> dataEndpoints,
java.util.List<TimerEndpoint<?>> timerEndpoints)
Creates a receiver that is able to consume elements multiplexing on to the provided set of
endpoints.
|
java.util.List<java.lang.String> |
getUnfinishedEndpoints()
Get all unfinished data and timers endpoints represented as [transform_id]:data and
[transform_id]:timers:[timer_family_id].
|
boolean |
multiplexElements(org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements elements)
Dispatches the data and timers from the elements to corresponding receivers.
|
void |
reset()
Enables this receiver to be used again for another bundle.
|
public static BeamFnDataInboundObserver2 forConsumers(java.util.List<DataEndpoint<?>> dataEndpoints, java.util.List<TimerEndpoint<?>> timerEndpoints)
public void accept(org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements elements)
throws java.lang.Exception
accept in interface FnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements>java.lang.Exceptionpublic void flush()
throws java.lang.Exception
CloseableFnDataReceiverflush in interface CloseableFnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements>java.lang.Exceptionpublic void close()
throws java.lang.Exception
CloseableFnDataReceiverDoes nothing if this CloseableFnDataReceiver is already closed.
close in interface java.lang.AutoCloseableclose in interface CloseableFnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements>java.lang.Exceptionpublic void awaitCompletion()
throws java.lang.Exception
Erroneous elements passed from the producer will be visible to the caller of this method.
java.lang.Exceptionpublic boolean multiplexElements(org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements elements)
throws java.lang.Exception
java.lang.Exceptionpublic void reset()
public java.util.List<java.lang.String> getUnfinishedEndpoints()