本文整理汇总了Java中org.apache.flink.streaming.api.watermark.Watermark.getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Java Watermark.getTimestamp方法的具体用法?Java Watermark.getTimestamp怎么用?Java Watermark.getTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.streaming.api.watermark.Watermark
的用法示例。
在下文中一共展示了Watermark.getTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateMinPunctuatedWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
/**
*Checks whether a new per-partition watermark is also a new cross-partition watermark.
*/
private void updateMinPunctuatedWatermark(Watermark nextWatermark) {
if (nextWatermark.getTimestamp() > maxWatermarkSoFar) {
long newMin = Long.MAX_VALUE;
for (KafkaTopicPartitionState<?> state : allPartitions) {
@SuppressWarnings("unchecked")
final KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> withWatermarksState =
(KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH>) state;
newMin = Math.min(newMin, withWatermarksState.getCurrentPartitionWatermark());
}
// double-check locking pattern
if (newMin > maxWatermarkSoFar) {
synchronized (checkpointLock) {
if (newMin > maxWatermarkSoFar) {
maxWatermarkSoFar = newMin;
sourceContext.emitWatermark(new Watermark(newMin));
}
}
}
}
}
示例2: updateMinPunctuatedWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
/**
*Checks whether a new per-partition watermark is also a new cross-partition watermark.
*/
private void updateMinPunctuatedWatermark(Watermark nextWatermark) {
if (nextWatermark.getTimestamp() > maxWatermarkSoFar) {
long newMin = Long.MAX_VALUE;
for (KafkaTopicPartitionState<?> state : subscribedPartitionStates) {
@SuppressWarnings("unchecked")
final KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> withWatermarksState =
(KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH>) state;
newMin = Math.min(newMin, withWatermarksState.getCurrentPartitionWatermark());
}
// double-check locking pattern
if (newMin > maxWatermarkSoFar) {
synchronized (checkpointLock) {
if (newMin > maxWatermarkSoFar) {
maxWatermarkSoFar = newMin;
sourceContext.emitWatermark(new Watermark(newMin));
}
}
}
}
}
示例3: processWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void processWatermark(Watermark mark) throws Exception {
// we do our own watermark handling, no super call. we will never be able to use
// the timer service like this, however.
if (priorityQueue.isEmpty()) {
advanceTime(nfa, mark.getTimestamp());
} else {
while (!priorityQueue.isEmpty() && priorityQueue.peek().getTimestamp() <= mark.getTimestamp()) {
StreamRecord<IN> streamRecord = priorityQueue.poll();
processEvent(nfa, streamRecord.getValue(), streamRecord.getTimestamp());
}
}
output.emitWatermark(mark);
}
示例4: processWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void processWatermark(Watermark mark) throws Exception {
while (!priorityQueue.isEmpty() && priorityQueue.peek().getTimestamp() <= mark.getTimestamp()) {
StreamRecord<IN> streamRecord = priorityQueue.poll();
String streamId = getStreamId(streamRecord.getValue());
long timestamp = streamRecord.getTimestamp();
StreamSchema<IN> schema = siddhiPlan.getInputStreamSchema(streamId);
processEvent(streamId, schema, streamRecord.getValue(), timestamp);
}
output.emitWatermark(mark);
}
示例5: processWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void processWatermark(Watermark mark) throws Exception {
while (!priorityQueue.isEmpty() && priorityQueue.peek().getTimestamp() <= mark.getTimestamp()) {
StreamRecord<IN> streamRecord = priorityQueue.poll();
String streamId = getStreamId(streamRecord.getValue());
long timestamp = streamRecord.getTimestamp();
StreamSchema<IN> schema = siddhiPlan.getInputStreamSchema(streamId);
processEvent(streamId, schema, streamRecord.getValue(), timestamp);
}
output.emitWatermark(mark);
}
示例6: processWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void processWatermark(Watermark mark) throws Exception {
wmCount++;
if (lastWM <= mark.getTimestamp()) {
lastWM = mark.getTimestamp();
} else {
throw new RuntimeException("Received watermark higher than the last one");
}
if (mark.getTimestamp() % 11 != 0 && mark.getTimestamp() != Long.MAX_VALUE) {
throw new RuntimeException("Invalid watermark: " + mark.getTimestamp());
}
}
示例7: handleWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void handleWatermark(Watermark watermark) {
try {
synchronized (lock) {
lastEmittedWatermark = watermark.getTimestamp();
operator.processWatermark(watermark);
}
} catch (Exception e) {
throw new RuntimeException("Exception occurred while processing valve output watermark: ", e);
}
}
示例8: processWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
/**
* Override the base implementation to completely ignore watermarks propagated from
* upstream (we rely only on the {@link AssignerWithPunctuatedWatermarks} to emit
* watermarks from here).
*/
@Override
public void processWatermark(Watermark mark) throws Exception {
// if we receive a Long.MAX_VALUE watermark we forward it since it is used
// to signal the end of input and to not block watermark progress downstream
if (mark.getTimestamp() == Long.MAX_VALUE && currentWatermark != Long.MAX_VALUE) {
currentWatermark = Long.MAX_VALUE;
output.emitWatermark(mark);
}
}
示例9: processWatermark1
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
public void processWatermark1(Watermark mark) throws Exception {
input1Watermark = mark.getTimestamp();
long newMin = Math.min(input1Watermark, input2Watermark);
if (newMin > combinedWatermark) {
combinedWatermark = newMin;
processWatermark(new Watermark(combinedWatermark));
}
}
示例10: processWatermark2
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
public void processWatermark2(Watermark mark) throws Exception {
input2Watermark = mark.getTimestamp();
long newMin = Math.min(input1Watermark, input2Watermark);
if (newMin > combinedWatermark) {
combinedWatermark = newMin;
processWatermark(new Watermark(combinedWatermark));
}
}
示例11: checkAndGetNewWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Nullable
public Watermark checkAndGetNewWatermark(T record, long timestamp) {
Watermark mark = timestampsAndWatermarks.checkAndGetNextWatermark(record, timestamp);
if (mark != null && mark.getTimestamp() > partitionWatermark) {
partitionWatermark = mark.getTimestamp();
return mark;
}
else {
return null;
}
}
示例12: handleWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void handleWatermark(Watermark watermark) {
try {
synchronized (lock) {
lastEmittedWatermark1 = watermark.getTimestamp();
operator.processWatermark1(watermark);
}
} catch (Exception e) {
throw new RuntimeException("Exception occurred while processing valve output watermark: ", e);
}
}
示例13: onProcessingTime
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void onProcessingTime(long timestamp) throws Exception {
// register next timer
Watermark newWatermark = userFunction.getCurrentWatermark();
if (newWatermark != null && newWatermark.getTimestamp() > currentWatermark) {
currentWatermark = newWatermark.getTimestamp();
// emit watermark
output.emitWatermark(newWatermark);
}
long now = getProcessingTimeService().getCurrentProcessingTime();
getProcessingTimeService().registerTimer(now + watermarkInterval, this);
}
示例14: processWatermark
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
/**
* Override the base implementation to completely ignore watermarks propagated from
* upstream (we rely only on the {@link AssignerWithPeriodicWatermarks} to emit
* watermarks from here).
*/
@Override
public void processWatermark(Watermark mark) throws Exception {
// if we receive a Long.MAX_VALUE watermark we forward it since it is used
// to signal the end of input and to not block watermark progress downstream
if (mark.getTimestamp() == Long.MAX_VALUE && currentWatermark != Long.MAX_VALUE) {
currentWatermark = Long.MAX_VALUE;
output.emitWatermark(mark);
}
}
示例15: close
import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void close() throws Exception {
super.close();
// emit a final watermark
Watermark newWatermark = userFunction.getCurrentWatermark();
if (newWatermark != null && newWatermark.getTimestamp() > currentWatermark) {
currentWatermark = newWatermark.getTimestamp();
// emit watermark
output.emitWatermark(newWatermark);
}
}