Java Code Examples for org.apache.samza.system.IncomingMessageEnvelope#getEventTime()

The following examples show how to use org.apache.samza.system.IncomingMessageEnvelope#getEventTime() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiFileHdfsReader.java    From samza with Apache License 2.0 5 votes vote down vote up
public IncomingMessageEnvelope readNext() {
  if (!hasNext()) {
    LOG.warn("Attempting to read more data when there aren't any. ssp=" + systemStreamPartition);
    return null;
  }
  // record the next offset before we read, so when the read fails and we reconnect,
  // we seek to the same offset that we try below
  curSingleFileOffset = curReader.nextOffset();
  IncomingMessageEnvelope messageEnvelope = curReader.readNext();
  // Copy everything except for the offset. Turn the single-file style offset into a multi-file one
  return new IncomingMessageEnvelope(messageEnvelope.getSystemStreamPartition(), getCurOffset(),
    messageEnvelope.getKey(), messageEnvelope.getMessage(), messageEnvelope.getSize(),
    messageEnvelope.getEventTime(), messageEnvelope.getArrivalTime());
}
 
Example 2
Source File: SamzaSqlInputTransformer.java    From samza with Apache License 2.0 5 votes vote down vote up
@Override
public Object apply(IncomingMessageEnvelope ime) {
  Assert.notNull(ime, "ime is null");
  KV<Object, Object> keyAndMessageKV = KV.of(ime.getKey(), ime.getMessage());
  SamzaSqlRelMsgMetadata metadata = new SamzaSqlRelMsgMetadata(ime.getEventTime(), ime.getArrivalTime());
  SamzaSqlInputMessage samzaMsg = SamzaSqlInputMessage.of(keyAndMessageKV, metadata);
  return  samzaMsg;
}