com.amazonaws.services.kinesis.model.Record.getApproximateArrivalTimestamp()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(14.0k)|赞(0)|评价(0)|浏览(108)

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

Record.getApproximateArrivalTimestamp介绍

[英]The approximate time that the record was inserted into the stream.
[中]记录插入流的大致时间。

代码示例

代码示例来源:origin: aws/aws-sdk-java

@Override
public int hashCode() {
  final int prime = 31;
  int hashCode = 1;
  hashCode = prime * hashCode + ((getSequenceNumber() == null) ? 0 : getSequenceNumber().hashCode());
  hashCode = prime * hashCode + ((getApproximateArrivalTimestamp() == null) ? 0 : getApproximateArrivalTimestamp().hashCode());
  hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode());
  hashCode = prime * hashCode + ((getPartitionKey() == null) ? 0 : getPartitionKey().hashCode());
  hashCode = prime * hashCode + ((getEncryptionType() == null) ? 0 : getEncryptionType().hashCode());
  return hashCode;
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
 * redacted from this string using a placeholder value.
 *
 * @return A string representation of this object.
 *
 * @see java.lang.Object#toString()
 */
@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  sb.append("{");
  if (getSequenceNumber() != null)
    sb.append("SequenceNumber: ").append(getSequenceNumber()).append(",");
  if (getApproximateArrivalTimestamp() != null)
    sb.append("ApproximateArrivalTimestamp: ").append(getApproximateArrivalTimestamp()).append(",");
  if (getData() != null)
    sb.append("Data: ").append(getData()).append(",");
  if (getPartitionKey() != null)
    sb.append("PartitionKey: ").append(getPartitionKey()).append(",");
  if (getEncryptionType() != null)
    sb.append("EncryptionType: ").append(getEncryptionType());
  sb.append("}");
  return sb.toString();
}

代码示例来源:origin: aws/aws-sdk-java

if (other.getSequenceNumber() != null && other.getSequenceNumber().equals(this.getSequenceNumber()) == false)
  return false;
if (other.getApproximateArrivalTimestamp() == null ^ this.getApproximateArrivalTimestamp() == null)
  return false;
if (other.getApproximateArrivalTimestamp() != null && other.getApproximateArrivalTimestamp().equals(this.getApproximateArrivalTimestamp()) == false)
  return false;
if (other.getData() == null ^ this.getData() == null)

代码示例来源:origin: aws/aws-sdk-java

/**
 * Marshall the given parameter object.
 */
public void marshall(Record record, ProtocolMarshaller protocolMarshaller) {
  if (record == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  try {
    protocolMarshaller.marshall(record.getSequenceNumber(), SEQUENCENUMBER_BINDING);
    protocolMarshaller.marshall(record.getApproximateArrivalTimestamp(), APPROXIMATEARRIVALTIMESTAMP_BINDING);
    protocolMarshaller.marshall(record.getData(), DATA_BINDING);
    protocolMarshaller.marshall(record.getPartitionKey(), PARTITIONKEY_BINDING);
    protocolMarshaller.marshall(record.getEncryptionType(), ENCRYPTIONTYPE_BINDING);
  } catch (Exception e) {
    throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
  }
}

代码示例来源:origin: aws-amplify/aws-sdk-android

@Override
public int hashCode() {
  final int prime = 31;
  int hashCode = 1;
  hashCode = prime * hashCode
      + ((getSequenceNumber() == null) ? 0 : getSequenceNumber().hashCode());
  hashCode = prime
      * hashCode
      + ((getApproximateArrivalTimestamp() == null) ? 0
          : getApproximateArrivalTimestamp().hashCode());
  hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode());
  hashCode = prime * hashCode
      + ((getPartitionKey() == null) ? 0 : getPartitionKey().hashCode());
  hashCode = prime * hashCode
      + ((getEncryptionType() == null) ? 0 : getEncryptionType().hashCode());
  return hashCode;
}

代码示例来源:origin: aws-amplify/aws-sdk-android

/**
 * Returns a string representation of this object; useful for testing and
 * debugging.
 *
 * @return A string representation of this object.
 * @see java.lang.Object#toString()
 */
@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  sb.append("{");
  if (getSequenceNumber() != null)
    sb.append("SequenceNumber: " + getSequenceNumber() + ",");
  if (getApproximateArrivalTimestamp() != null)
    sb.append("ApproximateArrivalTimestamp: " + getApproximateArrivalTimestamp() + ",");
  if (getData() != null)
    sb.append("Data: " + getData() + ",");
  if (getPartitionKey() != null)
    sb.append("PartitionKey: " + getPartitionKey() + ",");
  if (getEncryptionType() != null)
    sb.append("EncryptionType: " + getEncryptionType());
  sb.append("}");
  return sb.toString();
}

代码示例来源:origin: aws-amplify/aws-sdk-android

&& other.getSequenceNumber().equals(this.getSequenceNumber()) == false)
  return false;
if (other.getApproximateArrivalTimestamp() == null
    ^ this.getApproximateArrivalTimestamp() == null)
  return false;
if (other.getApproximateArrivalTimestamp() != null
    && other.getApproximateArrivalTimestamp().equals(
        this.getApproximateArrivalTimestamp()) == false)
  return false;
if (other.getData() == null ^ this.getData() == null)

代码示例来源:origin: aws-amplify/aws-sdk-android

public void marshall(Record record, AwsJsonWriter jsonWriter) throws Exception {
  jsonWriter.beginObject();
  if (record.getSequenceNumber() != null) {
    String sequenceNumber = record.getSequenceNumber();
    jsonWriter.name("SequenceNumber");
    jsonWriter.value(sequenceNumber);
  }
  if (record.getApproximateArrivalTimestamp() != null) {
    java.util.Date approximateArrivalTimestamp = record.getApproximateArrivalTimestamp();
    jsonWriter.name("ApproximateArrivalTimestamp");
    jsonWriter.value(approximateArrivalTimestamp);
  }
  if (record.getData() != null) {
    java.nio.ByteBuffer data = record.getData();
    jsonWriter.name("Data");
    jsonWriter.value(data);
  }
  if (record.getPartitionKey() != null) {
    String partitionKey = record.getPartitionKey();
    jsonWriter.name("PartitionKey");
    jsonWriter.value(partitionKey);
  }
  if (record.getEncryptionType() != null) {
    String encryptionType = record.getEncryptionType();
    jsonWriter.name("EncryptionType");
    jsonWriter.value(encryptionType);
  }
  jsonWriter.endObject();
}

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

public void updateMetrics(String stream, Record record) {
  eventReadRates.get(stream).inc();
  aggEventReadRate.inc();

  long recordSize = record.getData().array().length + record.getPartitionKey().length();
  eventByteReadRates.get(stream).inc(recordSize);
  aggEventByteReadRate.inc(recordSize);

  long latencyMs = Duration.between(Instant.now(), record.getApproximateArrivalTimestamp().toInstant()).toMillis();
  readLatencies.get(stream).update(latencyMs);
  aggReadLatency.update(latencyMs);
 }
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-kinesis

@Override
public int hashCode() {
  final int prime = 31;
  int hashCode = 1;
  hashCode = prime * hashCode + ((getSequenceNumber() == null) ? 0 : getSequenceNumber().hashCode());
  hashCode = prime * hashCode + ((getApproximateArrivalTimestamp() == null) ? 0 : getApproximateArrivalTimestamp().hashCode());
  hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode());
  hashCode = prime * hashCode + ((getPartitionKey() == null) ? 0 : getPartitionKey().hashCode());
  hashCode = prime * hashCode + ((getEncryptionType() == null) ? 0 : getEncryptionType().hashCode());
  return hashCode;
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-kinesis

/**
 * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
 * redacted from this string using a placeholder value.
 *
 * @return A string representation of this object.
 *
 * @see java.lang.Object#toString()
 */
@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  sb.append("{");
  if (getSequenceNumber() != null)
    sb.append("SequenceNumber: ").append(getSequenceNumber()).append(",");
  if (getApproximateArrivalTimestamp() != null)
    sb.append("ApproximateArrivalTimestamp: ").append(getApproximateArrivalTimestamp()).append(",");
  if (getData() != null)
    sb.append("Data: ").append(getData()).append(",");
  if (getPartitionKey() != null)
    sb.append("PartitionKey: ").append(getPartitionKey()).append(",");
  if (getEncryptionType() != null)
    sb.append("EncryptionType: ").append(getEncryptionType());
  sb.append("}");
  return sb.toString();
}

代码示例来源:origin: com.amazonaws/amazon-kinesis-client

/**
 * Convenience constructor.
 *
 * @param record The record that this message will represent.
 */
public JsonFriendlyRecord(Record record) {
  this.data = record.getData() == null ? null : record.getData().array();
  this.partitionKey = record.getPartitionKey();
  this.sequenceNumber = record.getSequenceNumber();
  this.approximateArrivalTimestamp = record.getApproximateArrivalTimestamp();
  if (record instanceof UserRecord) {
    this.subSequenceNumber = ((UserRecord) record).getSubSequenceNumber();
  } else {
    this.subSequenceNumber = null;
  }
}

代码示例来源:origin: com.amazonaws/amazon-kinesis-client

List<String> pks = ar.getPartitionKeyTableList();
List<String> ehks = ar.getExplicitHashKeyTableList();
long aat = r.getApproximateArrivalTimestamp() == null
    ? -1 : r.getApproximateArrivalTimestamp().getTime();
try {
  int recordsInCurrRecord = 0;

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

private IncomingMessageEnvelope translate(SystemStreamPartition ssp, Record record) {
 String shardId = processors.get(ssp).getShardId();
 byte[] payload = new byte[record.getData().remaining()];
 metrics.updateMetrics(ssp.getStream(), record);
 record.getData().get(payload);
 KinesisSystemConsumerOffset offset = new KinesisSystemConsumerOffset(shardId, record.getSequenceNumber());
 return new KinesisIncomingMessageEnvelope(ssp, offset.toString(), record.getPartitionKey(),
   payload, shardId, record.getSequenceNumber(), record.getApproximateArrivalTimestamp());
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-kinesis

if (other.getSequenceNumber() != null && other.getSequenceNumber().equals(this.getSequenceNumber()) == false)
  return false;
if (other.getApproximateArrivalTimestamp() == null ^ this.getApproximateArrivalTimestamp() == null)
  return false;
if (other.getApproximateArrivalTimestamp() != null && other.getApproximateArrivalTimestamp().equals(this.getApproximateArrivalTimestamp()) == false)
  return false;
if (other.getData() == null ^ this.getData() == null)

代码示例来源:origin: com.amazonaws/aws-java-sdk-kinesis

/**
 * Marshall the given parameter object.
 */
public void marshall(Record record, ProtocolMarshaller protocolMarshaller) {
  if (record == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  try {
    protocolMarshaller.marshall(record.getSequenceNumber(), SEQUENCENUMBER_BINDING);
    protocolMarshaller.marshall(record.getApproximateArrivalTimestamp(), APPROXIMATEARRIVALTIMESTAMP_BINDING);
    protocolMarshaller.marshall(record.getData(), DATA_BINDING);
    protocolMarshaller.marshall(record.getPartitionKey(), PARTITIONKEY_BINDING);
    protocolMarshaller.marshall(record.getEncryptionType(), ENCRYPTIONTYPE_BINDING);
  } catch (Exception e) {
    throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
  }
}

代码示例来源:origin: com.amazonaws/amazon-kinesis-client

/**
 * Create a User Record.
 * 
 * @param aggregated whether the record is aggregated
 * @param record Kinesis record
 * @param subSequenceNumber subsequence number
 * @param explicitHashKey explicit hash key
 */
protected UserRecord(boolean aggregated, Record record, long subSequenceNumber, String explicitHashKey) {
  if (subSequenceNumber < 0) {
    throw new IllegalArgumentException("Cannot have an invalid, negative subsequence number");
  }
  
  this.aggregated = aggregated;
  this.subSequenceNumber = subSequenceNumber;
  this.explicitHashKey = explicitHashKey;
  
  this.setSequenceNumber(record.getSequenceNumber());
  this.setData(record.getData());
  this.setPartitionKey(record.getPartitionKey());
  this.setApproximateArrivalTimestamp(record.getApproximateArrivalTimestamp());
}

代码示例来源:origin: Nextdoor/bender

private KinesisWrapper(final InternalEvent internal) {
 KinesisEventRecord eventRecord = ((KinesisInternalEvent) internal).getRecord();
 Record record = eventRecord.getKinesis();
 this.partitionKey = record.getPartitionKey();
 this.sequenceNumber = record.getSequenceNumber();
 this.eventSource = eventRecord.getEventSource();
 this.sourceArn = eventRecord.getEventSourceARN();
 this.functionName = internal.getCtx().getContext().getFunctionName();
 this.functionVersion = internal.getCtx().getContext().getFunctionVersion();
 this.processingTime = System.currentTimeMillis();
 this.arrivalTime = record.getApproximateArrivalTimestamp().getTime();
 this.timestamp = internal.getEventTime();
 this.processingDelay = processingTime - timestamp;
 if (internal.getEventObj() != null) {
  this.payload = internal.getEventObj().getPayload();
 } else {
  this.payload = null;
 }
}

代码示例来源:origin: Nextdoor/bender

private KinesisWrapper(final InternalEvent internal) {
 KinesisEventRecord eventRecord = ((KinesisInternalEvent) internal).getRecord();
 Record record = eventRecord.getKinesis();
 this.partitionKey = record.getPartitionKey();
 this.sequenceNumber = record.getSequenceNumber();
 this.eventSource = eventRecord.getEventSource();
 this.sourceArn = eventRecord.getEventSourceARN();
 this.functionName = internal.getCtx().getContext().getFunctionName();
 this.functionVersion = internal.getCtx().getContext().getFunctionVersion();
 this.processingTime = System.currentTimeMillis();
 this.arrivalTime = record.getApproximateArrivalTimestamp().getTime();
 this.timestamp = internal.getEventTime();
 this.processingDelay = processingTime - timestamp;
 if (internal.getEventObj() != null) {
  this.payload = internal.getEventObj().getPayload();
 } else {
  this.payload = null;
 }
}

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

private void verifyRecords(List<IncomingMessageEnvelope> outputRecords, List<Record> inputRecords, String shardId) {
 Iterator outputRecordsIter = outputRecords.iterator();
 inputRecords.forEach(record -> {
   IncomingMessageEnvelope envelope = (IncomingMessageEnvelope) outputRecordsIter.next();
   String outputKey = (String) envelope.getKey();
   KinesisIncomingMessageEnvelope kinesisMessageEnvelope = (KinesisIncomingMessageEnvelope) envelope;
   Assert.assertEquals(outputKey, record.getPartitionKey());
   Assert.assertEquals(kinesisMessageEnvelope.getSequenceNumber(), record.getSequenceNumber());
   Assert.assertEquals(kinesisMessageEnvelope.getApproximateArrivalTimestamp(),
     record.getApproximateArrivalTimestamp());
   Assert.assertEquals(kinesisMessageEnvelope.getShardId(), shardId);
   ByteBuffer outputData = ByteBuffer.wrap((byte[]) kinesisMessageEnvelope.getMessage());
   record.getData().rewind();
   Assert.assertTrue(outputData.equals(record.getData()));
   verifyOffset(envelope.getOffset(), record, shardId);
  });
}

相关文章