Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleJava API
linenumberstrue
collapsetrue
public interface StreamerTarget<T> {
   /**
    * Streams data into the table.
    *
    * @param publisher Producer.
    * @return Future that will be completed when the stream is finished.
    */
   CompletableFuture<Void> streamData(
           Flow.Publisher<T> publisher,
           @Nullable DataStreamerOptions options);


   /**
    * Streams data into the cluster with a receiver.
    *
    * @param publisher Producer.
    * @param keyAccessor Key accessor. Required to determine target node from the entry key.
    * @param receiver Stream receiver. Will be invoked on the target node.
    * @param resultSubscriber Optional stream result subscriber. Will be invoked on the current client
    * for every non-null result returned by the receiver.
    * @return Future that will be completed when the stream is finished.
    * @param <S> Source item type.
    * @param <R> Result item type.
    */
   <S, R> CompletableFuture<Void> streamData(
           Flow.Publisher<S> publisher,
           Function<S, T> keyAccessor,
           StreamReceiver<S, R> receiver,
           @Nullable Flow.Subscriber<R> resultSubscriber,
           @Nullable DataStreamerOptions options);
}

...


Code Block
languagec#
title.NET API
linenumberstrue
public interface IStreamerTarget<in T>

...

{

...


{
   Task StreamDataAsync(IAsyncEnumerable<T> stream, StreamerOptions? options = null);

...




   Task StreamDataAsync<TItem, TResult>(

...


       IAsyncEnumerable<TItem> stream,
       Func<TItem, T> keySelector,
       string receiverClassName,
       IStreamerResultListener<TResult>? resultListener,
       StreamerOptions? options = null);
}


Partition Awareness

  • Use case 1 (stream directly to a table): same partition awareness logic as in Table API, based on the known schema and partition distribution. Batching should be performed on a per-node basis.
  • Use case 2 (stream of custom objects): keyFunction is used to map custom objects to keys, then existing partition awareness logic from Table API is used.

...