Search in sources :

Example 1 with MultiLongWatermark

use of org.apache.gobblin.source.extractor.extract.kafka.MultiLongWatermark in project incubator-gobblin by apache.

the class KafkaWorkUnitPacker method getWatermarkIntervalFromWorkUnit.

@SuppressWarnings("deprecation")
protected static WatermarkInterval getWatermarkIntervalFromWorkUnit(WorkUnit workUnit) {
    if (workUnit instanceof MultiWorkUnit) {
        return getWatermarkIntervalFromMultiWorkUnit((MultiWorkUnit) workUnit);
    }
    List<Long> lowWatermarkValues = Lists.newArrayList(workUnit.getLowWaterMark());
    List<Long> expectedHighWatermarkValues = Lists.newArrayList(workUnit.getHighWaterMark());
    return new WatermarkInterval(new MultiLongWatermark(lowWatermarkValues), new MultiLongWatermark(expectedHighWatermarkValues));
}
Also used : WatermarkInterval(org.apache.gobblin.source.extractor.WatermarkInterval) MultiWorkUnit(org.apache.gobblin.source.workunit.MultiWorkUnit) MultiLongWatermark(org.apache.gobblin.source.extractor.extract.kafka.MultiLongWatermark)

Example 2 with MultiLongWatermark

use of org.apache.gobblin.source.extractor.extract.kafka.MultiLongWatermark in project incubator-gobblin by apache.

the class KafkaWorkUnitPacker method getWatermarkIntervalFromMultiWorkUnit.

@SuppressWarnings("deprecation")
protected static WatermarkInterval getWatermarkIntervalFromMultiWorkUnit(MultiWorkUnit multiWorkUnit) {
    List<Long> lowWatermarkValues = Lists.newArrayList();
    List<Long> expectedHighWatermarkValues = Lists.newArrayList();
    for (WorkUnit workUnit : multiWorkUnit.getWorkUnits()) {
        lowWatermarkValues.add(workUnit.getLowWaterMark());
        expectedHighWatermarkValues.add(workUnit.getHighWaterMark());
    }
    return new WatermarkInterval(new MultiLongWatermark(lowWatermarkValues), new MultiLongWatermark(expectedHighWatermarkValues));
}
Also used : WatermarkInterval(org.apache.gobblin.source.extractor.WatermarkInterval) MultiLongWatermark(org.apache.gobblin.source.extractor.extract.kafka.MultiLongWatermark) MultiWorkUnit(org.apache.gobblin.source.workunit.MultiWorkUnit) WorkUnit(org.apache.gobblin.source.workunit.WorkUnit)

Aggregations

WatermarkInterval (org.apache.gobblin.source.extractor.WatermarkInterval)2 MultiLongWatermark (org.apache.gobblin.source.extractor.extract.kafka.MultiLongWatermark)2 MultiWorkUnit (org.apache.gobblin.source.workunit.MultiWorkUnit)2 WorkUnit (org.apache.gobblin.source.workunit.WorkUnit)1