Sink.Writer (Google Cloud Dataflow SDK 1.9.1 API)

Google Cloud Dataflow SDK for Java, version 1.9.1

Class Sink.Writer<T,WriteT>

  • Type Parameters:
    T - The type of object to write
    WriteT - The writer results type (e.g., the bundle's output filename, as String)
    Direct Known Subclasses:
    Enclosing class:

    public abstract static class Sink.Writer<T,WriteT>
    extends Object
    A Writer writes a bundle of elements from a PCollection to a sink. open(java.lang.String) is called before writing begins and close() is called after all elements in the bundle have been written. write(T) writes an element to the sink.

    Note that any access to static members or methods of a Writer must be thread-safe, as multiple instances of a Writer may be instantiated in different threads on the same worker.

    See Sink for more detailed documentation about the process of writing to a Sink.

    • Constructor Detail

      • Writer

        public Writer()
    • Method Detail

      • open

        public abstract void open(String uId)
                           throws Exception
        Performs bundle initialization. For example, creates a temporary file for writing or initializes any state that will be used across calls to write(T).

        The unique id that is given to open should be used to ensure that the writer's output does not interfere with the output of other Writers, as a bundle may be executed many times for fault tolerance. See Sink for more information about bundle ids.

      • write

        public abstract void write(T value)
                            throws Exception
        Called for each value in the bundle.
      • getWriteOperation

        public abstract Sink.WriteOperation<T,WriteT> getWriteOperation()
        Returns the write operation this writer belongs to.

이 페이지가 도움이 되었나요? 평가를 부탁드립니다.

다음에 대한 의견 보내기...

Dataflow: Stream & Batch Processing
도움이 필요하시나요? 지원 페이지를 방문하세요.