Read

Read gives utilities to read from a bounded and unbounded sources (by creating root PTransforms).

import org.apache.beam.sdk.io.Read

import org.apache.beam.sdk.Pipeline
val p = Pipeline.create()

import org.apache.beam.sdk.io.BoundedSource
val lines: BoundedSource = ???

val bounded = Read.from(lines)
p.apply("Read from bounded source", bounded)

Reading From Bounded Source — from Utility

<T> Bounded<T> from(
  BoundedSource<T> source)

from static method creates a Read.Bounded root PTransform for the given BoundedSource.

Reading From Unbounded Source — from Utility

<T> Unbounded<T> from(
  UnboundedSource<T, ?> source)

from static method creates a Read.Unbounded root PTransform for the given UnboundedSource.

Bounded Root PTransform

Bounded<T> is a root PTransform (PTransform<PBegin, PCollection<T>>).

Unbounded Root PTransform

Unbounded<T> is a root PTransform (PTransform<PBegin, PCollection<T>>).