Class RegistryJpaIO.Write<T>

  • Type Parameters:
    T - type of the entities to be written
    All Implemented Interfaces:
    java.io.Serializable, org.apache.beam.sdk.transforms.display.HasDisplayData
    Enclosing class:
    RegistryJpaIO

    public abstract static class RegistryJpaIO.Write<T>
    extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<T>,​org.apache.beam.sdk.values.PCollection<java.lang.Void>>
    A transform that writes a PCollection of entities to the SQL database using the JpaTransactionManager.

    Unlike typical BEAM RegistryJpaIO.Write transforms, the output type of this transform is PCollection<Void> instead of PDone. This deviation allows the sequencing of multiple PCollections: we have use cases where one collection of data must be completely written before another can start (due to foreign key constraints in the latter).

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_BATCH_SIZE  
      static java.lang.String DEFAULT_NAME  
      • Fields inherited from class org.apache.beam.sdk.transforms.PTransform

        name, resourceHints
    • Constructor Summary

      Constructors 
      Constructor Description
      Write()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract int batchSize()
      Number of elements to be written in one call.
      org.apache.beam.sdk.values.PCollection<java.lang.Void> expand​(org.apache.beam.sdk.values.PCollection<T> input)  
      abstract org.apache.beam.sdk.transforms.SerializableFunction<T,​java.lang.Object> jpaConverter()  
      abstract java.lang.String name()  
      RegistryJpaIO.Write<T> withBatchSize​(int batchSize)  
      RegistryJpaIO.Write<T> withJpaConverter​(org.apache.beam.sdk.transforms.SerializableFunction<T,​java.lang.Object> jpaConverter)
      An optional function that converts the input entities to a form that can be written into the database.
      RegistryJpaIO.Write<T> withName​(java.lang.String name)  
      • Methods inherited from class org.apache.beam.sdk.transforms.PTransform

        compose, compose, getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setResourceHints, toString, validate, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Write

        public Write()
    • Method Detail

      • name

        public abstract java.lang.String name()
      • batchSize

        public abstract int batchSize()
        Number of elements to be written in one call.
      • jpaConverter

        public abstract org.apache.beam.sdk.transforms.SerializableFunction<T,​java.lang.Object> jpaConverter()
      • withJpaConverter

        public RegistryJpaIO.Write<T> withJpaConverter​(org.apache.beam.sdk.transforms.SerializableFunction<T,​java.lang.Object> jpaConverter)
        An optional function that converts the input entities to a form that can be written into the database.
      • expand

        public org.apache.beam.sdk.values.PCollection<java.lang.Void> expand​(org.apache.beam.sdk.values.PCollection<T> input)
        Specified by:
        expand in class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<T>,​org.apache.beam.sdk.values.PCollection<java.lang.Void>>