Interface MappedBatchPublisher<K,V extends @Nullable Object>

Type Parameters:
K - type parameter indicating the type of keys to use for data load requests.
V - type parameter indicating the type of values returned

@PublicSpi @NullMarked public interface MappedBatchPublisher<K,V extends @Nullable Object>
A function that is invoked for batch loading a stream of data values indicated by the provided list of keys.

The function must call the provided Subscriber to process the key/value pairs it has retrieved to allow the future returned by DataLoader.load(Object) to complete as soon as the individual value is available (rather than when all values have been retrieved).

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    load(Set<K> keys, org.reactivestreams.Subscriber<Map.Entry<K,V>> subscriber)
    Called to batch the provided keys into a stream of map entries of keys and values.
  • Method Details

    • load

      void load(Set<K> keys, org.reactivestreams.Subscriber<Map.Entry<K,V>> subscriber)
      Called to batch the provided keys into a stream of map entries of keys and values.

      The idiomatic approach would be to create a reactive Publisher that provides the values given the keys and then subscribe to it with the provided Subscriber.

      Parameters:
      keys - the collection of keys to load
      subscriber - as values arrive you must call the subscriber for each value