org.apache.samza.system.WatermarkMessage.getTaskName()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.apache.samza.system.WatermarkMessage.getTaskName()方法的一些代码示例,展示了WatermarkMessage.getTaskName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WatermarkMessage.getTaskName()方法的具体详情如下:
包路径:org.apache.samza.system.WatermarkMessage
类名称:WatermarkMessage
方法名:getTaskName

WatermarkMessage.getTaskName介绍

暂无

代码示例

代码示例来源:origin: org.apache.samza/samza-core_2.11

/**
 * Update the state upon receiving a watermark message.
 * @param watermarkMessage message of {@link WatermarkMessage}
 * @param ssp system stream partition
 * @return true iff the stream has a new watermark
 */
void update(WatermarkMessage watermarkMessage, SystemStreamPartition ssp) {
 WatermarkState state = watermarkStates.get(ssp);
 if (state != null) {
  state.update(watermarkMessage.getTimestamp(), watermarkMessage.getTaskName());
 } else {
  LOG.error("SSP {} doesn't have watermark states", ssp);
 }
}

代码示例来源:origin: apache/samza

/**
 * Update the state upon receiving a watermark message.
 * @param watermarkMessage message of {@link WatermarkMessage}
 * @param ssp system stream partition
 * @return true iff the stream has a new watermark
 */
void update(WatermarkMessage watermarkMessage, SystemStreamPartition ssp) {
 WatermarkState state = watermarkStates.get(ssp);
 if (state != null) {
  state.update(watermarkMessage.getTimestamp(), watermarkMessage.getTaskName());
 } else {
  LOG.error("SSP {} doesn't have watermark states", ssp);
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.12

/**
 * Update the state upon receiving a watermark message.
 * @param watermarkMessage message of {@link WatermarkMessage}
 * @param ssp system stream partition
 * @return true iff the stream has a new watermark
 */
void update(WatermarkMessage watermarkMessage, SystemStreamPartition ssp) {
 WatermarkState state = watermarkStates.get(ssp);
 if (state != null) {
  state.update(watermarkMessage.getTimestamp(), watermarkMessage.getTaskName());
 } else {
  LOG.error("SSP {} doesn't have watermark states", ssp);
 }
}

代码示例来源:origin: org.apache.samza/samza-core

/**
 * Update the state upon receiving a watermark message.
 * @param watermarkMessage message of {@link WatermarkMessage}
 * @param ssp system stream partition
 * @return true iff the stream has a new watermark
 */
void update(WatermarkMessage watermarkMessage, SystemStreamPartition ssp) {
 WatermarkState state = watermarkStates.get(ssp);
 if (state != null) {
  state.update(watermarkMessage.getTimestamp(), watermarkMessage.getTaskName());
 } else {
  LOG.error("SSP {} doesn't have watermark states", ssp);
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.10

/**
 * Update the state upon receiving a watermark message.
 * @param watermarkMessage message of {@link WatermarkMessage}
 * @param ssp system stream partition
 * @return true iff the stream has a new watermark
 */
void update(WatermarkMessage watermarkMessage, SystemStreamPartition ssp) {
 WatermarkState state = watermarkStates.get(ssp);
 if (state != null) {
  state.update(watermarkMessage.getTimestamp(), watermarkMessage.getTaskName());
 } else {
  LOG.error("SSP {} doesn't have watermark states", ssp);
 }
}

代码示例来源:origin: apache/samza

/**
 * Aggregate the {@link WatermarkMessage} from each ssp into a watermark. Then call onWatermark() if
 * a new watermark exits.
 * @param watermarkMessage a {@link WatermarkMessage} object
 * @param ssp {@link SystemStreamPartition} that the message is coming from.
 * @param collector message collector
 * @param coordinator task coordinator
 */
public final void aggregateWatermark(WatermarkMessage watermarkMessage, SystemStreamPartition ssp,
  MessageCollector collector, TaskCoordinator coordinator) {
 LOG.debug("Received watermark {} from {}", watermarkMessage.getTimestamp(), ssp);
 watermarkStates.update(watermarkMessage, ssp);
 long watermark = watermarkStates.getWatermark(ssp.getSystemStream());
 if (currentWatermark < watermark) {
  LOG.debug("Got watermark {} from stream {}", watermark, ssp.getSystemStream());
  if (watermarkMessage.getTaskName() != null) {
   // This is the aggregation task, which already received all the watermark messages from upstream
   // broadcast the watermark to all the peer partitions
   controlMessageSender.broadcastToOtherPartitions(new WatermarkMessage(watermark), ssp, collector);
  }
  // populate the watermark through the dag
  onWatermark(watermark, collector, coordinator);
  // update metrics
  watermarkStates.updateAggregateMetric(ssp, watermark);
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.12

/**
 * Aggregate the {@link WatermarkMessage} from each ssp into a watermark. Then call onWatermark() if
 * a new watermark exits.
 * @param watermarkMessage a {@link WatermarkMessage} object
 * @param ssp {@link SystemStreamPartition} that the message is coming from.
 * @param collector message collector
 * @param coordinator task coordinator
 */
public final void aggregateWatermark(WatermarkMessage watermarkMessage, SystemStreamPartition ssp,
  MessageCollector collector, TaskCoordinator coordinator) {
 LOG.debug("Received watermark {} from {}", watermarkMessage.getTimestamp(), ssp);
 watermarkStates.update(watermarkMessage, ssp);
 long watermark = watermarkStates.getWatermark(ssp.getSystemStream());
 if (currentWatermark < watermark) {
  LOG.debug("Got watermark {} from stream {}", watermark, ssp.getSystemStream());
  if (watermarkMessage.getTaskName() != null) {
   // This is the aggregation task, which already received all the watermark messages from upstream
   // broadcast the watermark to all the peer partitions
   controlMessageSender.broadcastToOtherPartitions(new WatermarkMessage(watermark), ssp, collector);
  }
  // populate the watermark through the dag
  onWatermark(watermark, collector, coordinator);
  // update metrics
  watermarkStates.updateAggregateMetric(ssp, watermark);
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.11

/**
 * Aggregate the {@link WatermarkMessage} from each ssp into a watermark. Then call onWatermark() if
 * a new watermark exits.
 * @param watermarkMessage a {@link WatermarkMessage} object
 * @param ssp {@link SystemStreamPartition} that the message is coming from.
 * @param collector message collector
 * @param coordinator task coordinator
 */
public final void aggregateWatermark(WatermarkMessage watermarkMessage, SystemStreamPartition ssp,
  MessageCollector collector, TaskCoordinator coordinator) {
 LOG.debug("Received watermark {} from {}", watermarkMessage.getTimestamp(), ssp);
 watermarkStates.update(watermarkMessage, ssp);
 long watermark = watermarkStates.getWatermark(ssp.getSystemStream());
 if (currentWatermark < watermark) {
  LOG.debug("Got watermark {} from stream {}", watermark, ssp.getSystemStream());
  if (watermarkMessage.getTaskName() != null) {
   // This is the aggregation task, which already received all the watermark messages from upstream
   // broadcast the watermark to all the peer partitions
   controlMessageSender.broadcastToOtherPartitions(new WatermarkMessage(watermark), ssp, collector);
  }
  // populate the watermark through the dag
  onWatermark(watermark, collector, coordinator);
  // update metrics
  watermarkStates.updateAggregateMetric(ssp, watermark);
 }
}

代码示例来源:origin: org.apache.samza/samza-core

/**
 * Aggregate the {@link WatermarkMessage} from each ssp into a watermark. Then call onWatermark() if
 * a new watermark exits.
 * @param watermarkMessage a {@link WatermarkMessage} object
 * @param ssp {@link SystemStreamPartition} that the message is coming from.
 * @param collector message collector
 * @param coordinator task coordinator
 */
public final void aggregateWatermark(WatermarkMessage watermarkMessage, SystemStreamPartition ssp,
  MessageCollector collector, TaskCoordinator coordinator) {
 LOG.debug("Received watermark {} from {}", watermarkMessage.getTimestamp(), ssp);
 watermarkStates.update(watermarkMessage, ssp);
 long watermark = watermarkStates.getWatermark(ssp.getSystemStream());
 if (currentWatermark < watermark) {
  LOG.debug("Got watermark {} from stream {}", watermark, ssp.getSystemStream());
  if (watermarkMessage.getTaskName() != null) {
   // This is the aggregation task, which already received all the watermark messages from upstream
   // broadcast the watermark to all the peer partitions
   controlMessageSender.broadcastToOtherPartitions(new WatermarkMessage(watermark), ssp, collector);
  }
  // populate the watermark through the dag
  onWatermark(watermark, collector, coordinator);
  // update metrics
  watermarkStates.updateAggregateMetric(ssp, watermark);
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.10

/**
 * Aggregate the {@link WatermarkMessage} from each ssp into a watermark. Then call onWatermark() if
 * a new watermark exits.
 * @param watermarkMessage a {@link WatermarkMessage} object
 * @param ssp {@link SystemStreamPartition} that the message is coming from.
 * @param collector message collector
 * @param coordinator task coordinator
 */
public final void aggregateWatermark(WatermarkMessage watermarkMessage, SystemStreamPartition ssp,
  MessageCollector collector, TaskCoordinator coordinator) {
 LOG.debug("Received watermark {} from {}", watermarkMessage.getTimestamp(), ssp);
 watermarkStates.update(watermarkMessage, ssp);
 long watermark = watermarkStates.getWatermark(ssp.getSystemStream());
 if (currentWatermark < watermark) {
  LOG.debug("Got watermark {} from stream {}", watermark, ssp.getSystemStream());
  if (watermarkMessage.getTaskName() != null) {
   // This is the aggregation task, which already received all the watermark messages from upstream
   // broadcast the watermark to all the peer partitions
   controlMessageSender.broadcastToOtherPartitions(new WatermarkMessage(watermark), ssp, collector);
  }
  // populate the watermark through the dag
  onWatermark(watermark, collector, coordinator);
  // update metrics
  watermarkStates.updateAggregateMetric(ssp, watermark);
 }
}

代码示例来源:origin: apache/samza

@Test
public void testWatermarkMessageSerde() {
 IntermediateMessageSerde imserde = new IntermediateMessageSerde(new ObjectSerde());
 String taskName = "task-1";
 WatermarkMessage watermark = new WatermarkMessage(System.currentTimeMillis(), taskName);
 byte[] bytes = imserde.toBytes(watermark);
 WatermarkMessage de = (WatermarkMessage) imserde.fromBytes(bytes);
 assertEquals(MessageType.of(de), MessageType.WATERMARK);
 assertEquals(de.getTaskName(), taskName);
 assertTrue(de.getTimestamp() > 0);
}

相关文章