Package google.registry.beam.common
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<java.lang.Void>>
-
- google.registry.beam.common.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>>
Atransform
that writes a PCollection of entities to the SQL database using theJpaTransactionManager
.Unlike typical BEAM
RegistryJpaIO.Write
transforms, the output type of this transform isPCollection<Void>
instead ofPDone
. This deviation allows the sequencing of multiplePCollections
: 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
-
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)
-
-
-
Field Detail
-
DEFAULT_NAME
public static final java.lang.String DEFAULT_NAME
- See Also:
- Constant Field Values
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE
- See Also:
- Constant Field Values
-
-
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()
-
withName
public RegistryJpaIO.Write<T> withName(java.lang.String name)
-
withBatchSize
public RegistryJpaIO.Write<T> withBatchSize(int batchSize)
-
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.
-
-