co.decodable.sdk.pipeline.internal.DelegatingSplitEnumerator 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 java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.flink.api.connector.source.SplitEnumerator;
import org.apache.flink.connector.kafka.source.enumerator.KafkaSourceEnumState;
import org.apache.flink.connector.kafka.source.split.KafkaPartitionSplit;
public class DelegatingSplitEnumerator
implements SplitEnumerator {
private final SplitEnumerator delegate;
public DelegatingSplitEnumerator(
SplitEnumerator delegate) {
this.delegate = delegate;
}
@Override
public void start() {
delegate.start();
}
@Override
public void handleSplitRequest(int subtaskId, String requesterHostname) {
delegate.handleSplitRequest(subtaskId, requesterHostname);
}
@Override
public void addSplitsBack(List splits, int subtaskId) {
List delegateSplits =
splits.stream()
.map(s -> ((DecodableSourceSplitImpl) s).getDelegate())
.collect(Collectors.toList());
delegate.addSplitsBack(delegateSplits, subtaskId);
}
@Override
public void addReader(int subtaskId) {
delegate.addReader(subtaskId);
}
@Override
public DecodableSourceEnumeratorState snapshotState(long checkpointId) throws Exception {
return new DecodableSourceEnumeratorStateImpl(delegate.snapshotState(checkpointId));
}
@Override
public void close() throws IOException {
delegate.close();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy