co.decodable.sdk.pipeline.internal.DecodableStreamSourceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of decodable-pipeline-sdk Show documentation
Show all versions of decodable-pipeline-sdk Show documentation
A software development kit for implementing Apache Flink jobs and running them on Decodable
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright Decodable, Inc.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package co.decodable.sdk.pipeline.internal;
import co.decodable.sdk.pipeline.DecodableSourceEnumeratorState;
import co.decodable.sdk.pipeline.DecodableSourceSplit;
import co.decodable.sdk.pipeline.DecodableStreamSource;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.connector.source.Boundedness;
import org.apache.flink.api.connector.source.SourceReader;
import org.apache.flink.api.connector.source.SourceReaderContext;
import org.apache.flink.api.connector.source.SplitEnumerator;
import org.apache.flink.api.connector.source.SplitEnumeratorContext;
import org.apache.flink.connector.kafka.source.KafkaSource;
import org.apache.flink.core.io.SimpleVersionedSerializer;
class DecodableStreamSourceImpl implements DecodableStreamSource {
private static final long serialVersionUID = 7762732921098678433L;
private final KafkaSource delegate;
DecodableStreamSourceImpl(KafkaSource delegate) {
this.delegate = delegate;
}
@Override
public Boundedness getBoundedness() {
return delegate.getBoundedness();
}
@Override
public SourceReader createReader(SourceReaderContext readerContext)
throws Exception {
return new DelegatingSourceReader(delegate.createReader(readerContext));
}
@Override
public SplitEnumerator createEnumerator(
SplitEnumeratorContext enumContext) throws Exception {
return new DelegatingSplitEnumerator(
delegate.createEnumerator(new DelegatingSplitEnumeratorContext(enumContext)));
}
@Override
public SplitEnumerator restoreEnumerator(
SplitEnumeratorContext enumContext,
DecodableSourceEnumeratorState checkpoint)
throws Exception {
return new DelegatingSplitEnumerator(
delegate.restoreEnumerator(
new DelegatingSplitEnumeratorContext(enumContext),
((DecodableSourceEnumeratorStateImpl) checkpoint).getDelegate()));
}
@Override
public SimpleVersionedSerializer getSplitSerializer() {
return new DelegatingSplitSerializer(delegate.getSplitSerializer());
}
@Override
public SimpleVersionedSerializer
getEnumeratorCheckpointSerializer() {
return new DelegatingEnumeratorStateSerializer(delegate.getEnumeratorCheckpointSerializer());
}
@Override
public TypeInformation getProducedType() {
return delegate.getProducedType();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy