public interface FnDataService
FnDataServiceis able to forward inbound elements to a consumer and is also a consumer of outbound elements. Callers can register themselves as consumers for inbound elements or can get a handle for a consumer for outbound elements.
|Modifier and Type||Method and Description|
Registers a receiver for the provided instruction id.
Receivers are only expected to be unregistered when bundle processing has completed successfully.
void registerReceiver(java.lang.String instructionId, CloseableFnDataReceiver<org.apache.beam.model.fnexecution.v1.BeamFnApi.Elements> observer)
The receiver is not required to be thread safe.
Receivers for successfully processed bundles must be unregistered. See
unregisterReceiver(java.lang.String) for details.
Any failure during
FnDataReceiver.accept(T) will mark the provided
instructionId as invalid and will ignore any future data. It is expected that if a bundle
fails during processing then the failure will become visible to the
during a future
void unregisterReceiver(java.lang.String instructionId)
It is expected that if a bundle fails during processing then the failure will become visible
FnDataService during a future
BeamFnDataOutboundAggregator createOutboundAggregator(java.util.function.Supplier<java.lang.String> processBundleRequestIdSupplier, boolean collectElementsIfNoFlushes)
BeamFnDataOutboundAggregatorfor buffering and sending outbound data and timers over the data plane. It is important that
BeamFnDataOutboundAggregator.sendOrCollectBufferedDataAndFinishOutboundStreams()is called on the returned BeamFnDataOutboundAggregator at the end of each bundle. If collectElementsIfNoFlushes is set to true,
BeamFnDataOutboundAggregator.sendOrCollectBufferedDataAndFinishOutboundStreams()returns the buffered elements instead of sending it through the outbound StreamObserver if there's no previous flush.
Closing the returned aggregator signals the end of the streams.
The returned aggregator is not thread safe.