Search in sources :

Example 1 with DelegatingUnBoundedSource

use of org.talend.sdk.component.runtime.di.beam.DelegatingUnBoundedSource in project component-runtime by Talend.

the class DIPipeline method wrapTransformIfNeeded.

private <PT extends POutput> PTransform<? super PBegin, PT> wrapTransformIfNeeded(final PTransform<? super PBegin, PT> root) {
    if (Read.Bounded.class.isInstance(root)) {
        final BoundedSource source = Read.Bounded.class.cast(root).getSource();
        final DelegatingBoundedSource boundedSource = new DelegatingBoundedSource(source, null);
        setState(boundedSource);
        return Read.from(boundedSource);
    }
    if (Read.Unbounded.class.isInstance(root)) {
        final UnboundedSource source = Read.Unbounded.class.cast(root).getSource();
        if (InMemoryQueueIO.UnboundedQueuedInput.class.isInstance(source)) {
            return root;
        }
        final DelegatingUnBoundedSource unBoundedSource = new DelegatingUnBoundedSource(source, null);
        setState(unBoundedSource);
        return Read.from(unBoundedSource);
    }
    return root;
}
Also used : Read(org.apache.beam.sdk.io.Read) DelegatingUnBoundedSource(org.talend.sdk.component.runtime.di.beam.DelegatingUnBoundedSource) BoundedSource(org.apache.beam.sdk.io.BoundedSource) DelegatingBoundedSource(org.talend.sdk.component.runtime.di.beam.DelegatingBoundedSource) InMemoryQueueIO(org.talend.sdk.component.runtime.di.beam.InMemoryQueueIO) DelegatingBoundedSource(org.talend.sdk.component.runtime.di.beam.DelegatingBoundedSource) DelegatingUnBoundedSource(org.talend.sdk.component.runtime.di.beam.DelegatingUnBoundedSource) UnboundedSource(org.apache.beam.sdk.io.UnboundedSource)

Aggregations

BoundedSource (org.apache.beam.sdk.io.BoundedSource)1 Read (org.apache.beam.sdk.io.Read)1 UnboundedSource (org.apache.beam.sdk.io.UnboundedSource)1 DelegatingBoundedSource (org.talend.sdk.component.runtime.di.beam.DelegatingBoundedSource)1 DelegatingUnBoundedSource (org.talend.sdk.component.runtime.di.beam.DelegatingUnBoundedSource)1 InMemoryQueueIO (org.talend.sdk.component.runtime.di.beam.InMemoryQueueIO)1