Class RegistryJpaIO.Write<T>

java.lang.Object
org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<T>,org.apache.beam.sdk.values.PCollection<Void>>
google.registry.beam.common.RegistryJpaIO.Write<T>
Type Parameters:
T - type of the entities to be written
All Implemented Interfaces:
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<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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final String
     

    Fields inherited from class org.apache.beam.sdk.transforms.PTransform

    annotations, displayData, name, resourceHints
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract int
    Number of elements to be written in one call.
    org.apache.beam.sdk.values.PCollection<Void>
    expand(org.apache.beam.sdk.values.PCollection<T> input)
     
    abstract org.apache.beam.sdk.transforms.SerializableFunction<T,Object>
     
    abstract String
     
    withBatchSize(int batchSize)
     
    withJpaConverter(org.apache.beam.sdk.transforms.SerializableFunction<T,Object> jpaConverter)
    An optional function that converts the input entities to a form that can be written into the database.
     

    Methods inherited from class org.apache.beam.sdk.transforms.PTransform

    addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Write

      public Write()
  • Method Details

    • name

      public abstract 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,Object> jpaConverter()
    • withName

      public RegistryJpaIO.Write<T> withName(String name)
    • withBatchSize

      public RegistryJpaIO.Write<T> withBatchSize(int batchSize)
    • withJpaConverter

      public RegistryJpaIO.Write<T> withJpaConverter(org.apache.beam.sdk.transforms.SerializableFunction<T,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<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<Void>>