com.hazelcast.jet.core.processor

## Class SinkProcessors

- java.lang.Object
- - com.hazelcast.jet.core.processor.SinkProcessors

-     public final class SinkProcessors
      extends Object

  Static utility class with factories of sink processors (the terminators of the DAG data flow). For other kinds of processors refer to the `package-level documentation`.
  Since:
    3.0

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T,K,V> ProcessorMetaSupplier` | `mergeMapP(String mapName, FunctionEx<? super T,? extends K> toKeyFn, FunctionEx<? super T,? extends V> toValueFn, BinaryOperatorEx<V> mergeFn)` Returns a supplier of processors for `Sinks.mapWithMerging(String, FunctionEx, FunctionEx, BinaryOperatorEx)`.
    `static <T,K,V> ProcessorMetaSupplier` | `mergeRemoteMapP(String mapName, ClientConfig clientConfig, FunctionEx<? super T,? extends K> toKeyFn, FunctionEx<? super T,? extends V> toValueFn, BinaryOperatorEx<V> mergeFn)` Returns a supplier of processors for `Sinks.remoteMapWithMerging(String, ClientConfig, FunctionEx, FunctionEx, BinaryOperatorEx)`.
    `static <T,K,V> ProcessorMetaSupplier` | `updateMapP(String mapName, FunctionEx<? super T,? extends K> toKeyFn, BiFunctionEx<? super V,? super T,? extends V> updateFn)` Returns a supplier of processors for `Sinks.mapWithEntryProcessor(String, FunctionEx, FunctionEx)` .
    `static <T,K,V> ProcessorMetaSupplier` | `updateMapP(String mapName, FunctionEx<? super T,? extends K> toKeyFn, FunctionEx<? super T,? extends EntryProcessor<K,V>> toEntryProcessorFn)` Returns a supplier of processors for `Sinks.mapWithEntryProcessor(String, FunctionEx, FunctionEx)`.
    `static <T,K,V> ProcessorMetaSupplier` | `updateRemoteMapP(String mapName, ClientConfig clientConfig, FunctionEx<? super T,? extends K> toKeyFn, BiFunctionEx<? super V,? super T,? extends V> updateFn)` Returns a supplier of processors for `Sinks.remoteMapWithUpdating(String, ClientConfig, FunctionEx , BiFunctionEx)`.
    `static <T,K,V> ProcessorMetaSupplier` | `updateRemoteMapP(String mapName, ClientConfig clientConfig, FunctionEx<? super T,? extends K> toKeyFn, FunctionEx<? super T,? extends EntryProcessor<K,V>> toEntryProcessorFn)` Returns a supplier of processors for `Sinks.remoteMapWithEntryProcessor(String, ClientConfig, FunctionEx, FunctionEx)`.
    `static <W,T> SupplierEx<Processor>` | `writeBufferedP(FunctionEx<? super Processor.Context,? extends W> createFn, BiConsumerEx<? super W,? super T> onReceiveFn, ConsumerEx<? super W> flushFn)` Shortcut for `writeBufferedP(FunctionEx, BiConsumerEx, ConsumerEx, ConsumerEx)` with a no-op `destroyFn`.
    `static <W,T> SupplierEx<Processor>` | `writeBufferedP(FunctionEx<? super Processor.Context,? extends W> createFn, BiConsumerEx<? super W,? super T> onReceiveFn, ConsumerEx<? super W> flushFn, ConsumerEx<? super W> destroyFn)` Returns a supplier of processors for a vertex that drains all the items from the inbox to an internal writer object and then does a flush.
    `static <K,V> ProcessorMetaSupplier` | `writeCacheP(String cacheName)` Returns a supplier of processors for `Sinks.cache(String)`.
    `static <T> ProcessorMetaSupplier` | `writeFileP(String directoryName, FunctionEx<? super T,? extends String> toStringFn, Charset charset, boolean append)` Returns a supplier of processors for `Sinks.filesBuilder(java.lang.String)`.
    `static <T> ProcessorMetaSupplier` | `writeJdbcP(String updateQuery, SupplierEx<? extends Connection> newConnectionFn, BiConsumerEx<? super PreparedStatement,? super T> bindFn)` Returns a supplier of processors for `Sinks.jdbc(String, SupplierEx, BiConsumerEx)`.
    `static <T> ProcessorMetaSupplier` | `writeJmsQueueP(SupplierEx<? extends javax.jms.Connection> newConnectionFn, FunctionEx<? super javax.jms.Connection,? extends javax.jms.Session> newSessionFn, BiFunctionEx<? super javax.jms.Session,? super T,? extends javax.jms.Message> messageFn, BiConsumerEx<? super javax.jms.MessageProducer,? super javax.jms.Message> sendFn, ConsumerEx<? super javax.jms.Session> flushFn, String name)` Returns a supplier of processors for `Sinks.jmsQueueBuilder(com.hazelcast.jet.function.SupplierEx<javax.jms.ConnectionFactory>)`.
    `static <T> ProcessorMetaSupplier` | `writeJmsTopicP(SupplierEx<? extends javax.jms.Connection> newConnectionFn, FunctionEx<? super javax.jms.Connection,? extends javax.jms.Session> newSessionFn, BiFunctionEx<? super javax.jms.Session,? super T,? extends javax.jms.Message> messageFn, BiConsumerEx<? super javax.jms.MessageProducer,? super javax.jms.Message> sendFn, ConsumerEx<? super javax.jms.Session> flushFn, String name)` Returns a supplier of processors for `Sinks.jmsTopicBuilder(com.hazelcast.jet.function.SupplierEx<javax.jms.ConnectionFactory>)`.
    `static ProcessorMetaSupplier` | `writeListP(String listName)` Returns a supplier of processors for `Sinks.list(String)`.
    `static <K,V> ProcessorMetaSupplier` | `writeMapP(String mapName)` Returns a supplier of processors for `Sinks.map(String)`.
    `static <K,V> ProcessorMetaSupplier` | `writeRemoteCacheP(String cacheName, ClientConfig clientConfig)` Returns a supplier of processors for `Sinks.remoteCache(String, ClientConfig)`.
    `static ProcessorMetaSupplier` | `writeRemoteListP(String listName, ClientConfig clientConfig)` Returns a supplier of processors for `Sinks.remoteList(String, ClientConfig)`.
    `static <K,V> ProcessorMetaSupplier` | `writeRemoteMapP(String mapName, ClientConfig clientConfig)` Returns a supplier of processors for `Sinks.remoteMap(String, ClientConfig)`.
    `static <T> ProcessorMetaSupplier` | `writeSocketP(String host, int port, FunctionEx<? super T,? extends String> toStringFn, Charset charset)` Returns a supplier of processors for `Sinks.socket(String, int)`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### writeMapP

          @Nonnull
          public static <K,V> ProcessorMetaSupplier writeMapP(@Nonnull
                                                                       String mapName)

      Returns a supplier of processors for `Sinks.map(String)`.

    - #### writeRemoteMapP

          @Nonnull
          public static <K,V> ProcessorMetaSupplier writeRemoteMapP(@Nonnull
                                                                             String mapName,
                                                                             @Nonnull
                                                                             ClientConfig clientConfig)

      Returns a supplier of processors for `Sinks.remoteMap(String, ClientConfig)`.

    - #### mergeMapP

          @Nonnull
          public static <T,K,V> ProcessorMetaSupplier mergeMapP(@Nonnull
                                                                         String mapName,
                                                                         @Nonnull
                                                                         FunctionEx<? super T,? extends K> toKeyFn,
                                                                         @Nonnull
                                                                         FunctionEx<? super T,? extends V> toValueFn,
                                                                         @Nonnull
                                                                         BinaryOperatorEx<V> mergeFn)

      Returns a supplier of processors for `Sinks.mapWithMerging(String, FunctionEx, FunctionEx, BinaryOperatorEx)`.

    - #### mergeRemoteMapP

          @Nonnull
          public static <T,K,V> ProcessorMetaSupplier mergeRemoteMapP(@Nonnull
                                                                               String mapName,
                                                                               @Nonnull
                                                                               ClientConfig clientConfig,
                                                                               @Nonnull
                                                                               FunctionEx<? super T,? extends K> toKeyFn,
                                                                               @Nonnull
                                                                               FunctionEx<? super T,? extends V> toValueFn,
                                                                               @Nonnull
                                                                               BinaryOperatorEx<V> mergeFn)

      Returns a supplier of processors for `Sinks.remoteMapWithMerging(String, ClientConfig, FunctionEx, FunctionEx, BinaryOperatorEx)`.

    - #### updateMapP

          @Nonnull
          public static <T,K,V> ProcessorMetaSupplier updateMapP(@Nonnull
                                                                          String mapName,
                                                                          @Nonnull
                                                                          FunctionEx<? super T,? extends K> toKeyFn,
                                                                          @Nonnull
                                                                          BiFunctionEx<? super V,? super T,? extends V> updateFn)

      Returns a supplier of processors for `Sinks.mapWithEntryProcessor(String, FunctionEx, FunctionEx)` .

    - #### updateRemoteMapP

          @Nonnull
          public static <T,K,V> ProcessorMetaSupplier updateRemoteMapP(@Nonnull
                                                                                String mapName,
                                                                                @Nonnull
                                                                                ClientConfig clientConfig,
                                                                                @Nonnull
                                                                                FunctionEx<? super T,? extends K> toKeyFn,
                                                                                @Nonnull
                                                                                BiFunctionEx<? super V,? super T,? extends V> updateFn)

      Returns a supplier of processors for `Sinks.remoteMapWithUpdating(String, ClientConfig, FunctionEx , BiFunctionEx)`.

    - #### updateMapP

          @Nonnull
          public static <T,K,V> ProcessorMetaSupplier updateMapP(@Nonnull
                                                                          String mapName,
                                                                          @Nonnull
                                                                          FunctionEx<? super T,? extends K> toKeyFn,
                                                                          @Nonnull
                                                                          FunctionEx<? super T,? extends EntryProcessor<K,V>> toEntryProcessorFn)

      Returns a supplier of processors for `Sinks.mapWithEntryProcessor(String, FunctionEx, FunctionEx)`.

    - #### updateRemoteMapP

          @Nonnull
          public static <T,K,V> ProcessorMetaSupplier updateRemoteMapP(@Nonnull
                                                                                String mapName,
                                                                                @Nonnull
                                                                                ClientConfig clientConfig,
                                                                                @Nonnull
                                                                                FunctionEx<? super T,? extends K> toKeyFn,
                                                                                @Nonnull
                                                                                FunctionEx<? super T,? extends EntryProcessor<K,V>> toEntryProcessorFn)

      Returns a supplier of processors for `Sinks.remoteMapWithEntryProcessor(String, ClientConfig, FunctionEx, FunctionEx)`.

    - #### writeCacheP

          @Nonnull
          public static <K,V> ProcessorMetaSupplier writeCacheP(@Nonnull
                                                                         String cacheName)

      Returns a supplier of processors for `Sinks.cache(String)`.

    - #### writeRemoteCacheP

          @Nonnull
          public static <K,V> ProcessorMetaSupplier writeRemoteCacheP(@Nonnull
                                                                               String cacheName,
                                                                               @Nonnull
                                                                               ClientConfig clientConfig)

      Returns a supplier of processors for `Sinks.remoteCache(String, ClientConfig)`.

    - #### writeListP

          @Nonnull
          public static ProcessorMetaSupplier writeListP(@Nonnull
                                                                  String listName)

      Returns a supplier of processors for `Sinks.list(String)`.

    - #### writeRemoteListP

          @Nonnull
          public static ProcessorMetaSupplier writeRemoteListP(@Nonnull
                                                                        String listName,
                                                                        @Nonnull
                                                                        ClientConfig clientConfig)

      Returns a supplier of processors for `Sinks.remoteList(String, ClientConfig)`.

    - #### writeSocketP

          public static <T> ProcessorMetaSupplier writeSocketP(@Nonnull
                                                               String host,
                                                               int port,
                                                               @Nonnull
                                                               FunctionEx<? super T,? extends String> toStringFn,
                                                               @Nonnull
                                                               Charset charset)

      Returns a supplier of processors for `Sinks.socket(String, int)`.

    - #### writeFileP

          @Nonnull
          public static <T> ProcessorMetaSupplier writeFileP(@Nonnull
                                                                      String directoryName,
                                                                      @Nonnull
                                                                      FunctionEx<? super T,? extends String> toStringFn,
                                                                      @Nonnull
                                                                      Charset charset,
                                                                      boolean append)

      Returns a supplier of processors for `Sinks.filesBuilder(java.lang.String)`.

    - #### writeBufferedP

          @Nonnull
          public static <W,T> SupplierEx<Processor> writeBufferedP(@Nonnull
                                                                            FunctionEx<? super Processor.Context,? extends W> createFn,
                                                                            @Nonnull
                                                                            BiConsumerEx<? super W,? super T> onReceiveFn,
                                                                            @Nonnull
                                                                            ConsumerEx<? super W> flushFn)

      Shortcut for `writeBufferedP(FunctionEx, BiConsumerEx, ConsumerEx, ConsumerEx)` with a no-op `destroyFn`.

    - #### writeBufferedP

          @Nonnull
          public static <W,T> SupplierEx<Processor> writeBufferedP(@Nonnull
                                                                            FunctionEx<? super Processor.Context,? extends W> createFn,
                                                                            @Nonnull
                                                                            BiConsumerEx<? super W,? super T> onReceiveFn,
                                                                            @Nonnull
                                                                            ConsumerEx<? super W> flushFn,
                                                                            @Nonnull
                                                                            ConsumerEx<? super W> destroyFn)

      Returns a supplier of processors for a vertex that drains all the items from the inbox to an internal writer object and then does a flush. As each processor completes, it disposes of its writer by calling `destroyFn`.

      This is a useful building block to implement sinks with explicit control over resource management, buffering and flushing.

      The returned processor will have preferred local parallelism of 1. It will not participate in state saving for fault tolerance.

      Type Parameters:
        `W` - type of the writer
        `T` - type of the received item
      Parameters:
        `createFn` - supplies the writer. The argument to this function is the context for the given processor.
        `onReceiveFn` - function that Jet calls upon receiving each item for the sink
        `flushFn` - function that flushes the writer
        `destroyFn` - function that destroys the writer

    - #### writeJmsQueueP

          @Nonnull
          public static <T> ProcessorMetaSupplier writeJmsQueueP(@Nonnull
                                                                          SupplierEx<? extends javax.jms.Connection> newConnectionFn,
                                                                          @Nonnull
                                                                          FunctionEx<? super javax.jms.Connection,? extends javax.jms.Session> newSessionFn,
                                                                          @Nonnull
                                                                          BiFunctionEx<? super javax.jms.Session,? super T,? extends javax.jms.Message> messageFn,
                                                                          @Nonnull
                                                                          BiConsumerEx<? super javax.jms.MessageProducer,? super javax.jms.Message> sendFn,
                                                                          @Nonnull
                                                                          ConsumerEx<? super javax.jms.Session> flushFn,
                                                                          @Nonnull
                                                                          String name)

      Returns a supplier of processors for `Sinks.jmsQueueBuilder(com.hazelcast.jet.function.SupplierEx<javax.jms.ConnectionFactory>)`.

    - #### writeJmsTopicP

          @Nonnull
          public static <T> ProcessorMetaSupplier writeJmsTopicP(@Nonnull
                                                                          SupplierEx<? extends javax.jms.Connection> newConnectionFn,
                                                                          @Nonnull
                                                                          FunctionEx<? super javax.jms.Connection,? extends javax.jms.Session> newSessionFn,
                                                                          @Nonnull
                                                                          BiFunctionEx<? super javax.jms.Session,? super T,? extends javax.jms.Message> messageFn,
                                                                          @Nonnull
                                                                          BiConsumerEx<? super javax.jms.MessageProducer,? super javax.jms.Message> sendFn,
                                                                          @Nonnull
                                                                          ConsumerEx<? super javax.jms.Session> flushFn,
                                                                          @Nonnull
                                                                          String name)

      Returns a supplier of processors for `Sinks.jmsTopicBuilder(com.hazelcast.jet.function.SupplierEx<javax.jms.ConnectionFactory>)`.

    - #### writeJdbcP

          @Nonnull
          public static <T> ProcessorMetaSupplier writeJdbcP(@Nonnull
                                                                      String updateQuery,
                                                                      @Nonnull
                                                                      SupplierEx<? extends Connection> newConnectionFn,
                                                                      @Nonnull
                                                                      BiConsumerEx<? super PreparedStatement,? super T> bindFn)

      Returns a supplier of processors for `Sinks.jdbc(String, SupplierEx, BiConsumerEx)`.

Copyright © 2020. All rights reserved.