本文整理了Java中com.amazonaws.services.kinesis.model.Record.withApproximateArrivalTimestamp
方法的一些代码示例,展示了Record.withApproximateArrivalTimestamp
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.withApproximateArrivalTimestamp
方法的具体详情如下:
包路径:com.amazonaws.services.kinesis.model.Record
类名称:Record
方法名:withApproximateArrivalTimestamp
[英]The approximate time that the record was inserted into the stream.
[中]记录插入流的大致时间。
代码示例来源:origin: com.amazonaws/amazon-kinesis-client
.withPartitionKey(partitionKey)
.withSequenceNumber(r.getSequenceNumber())
.withApproximateArrivalTimestamp(aat < 0 ? null : new Date(aat));
result.add(new UserRecord(true, record, subSeqNum++, explicitHashKey));
代码示例来源:origin: Nextdoor/bender
rec.withPartitionKey("1").withSequenceNumber(r + "")
.withData(ByteBuffer.wrap(line.getBytes()))
.withApproximateArrivalTimestamp(approximateArrivalTimestamp);
代码示例来源:origin: apache/samza
private static List<Record> createRecords(int numRecords) {
List<Record> records = new ArrayList<>(numRecords);
Random rand = new Random();
for (int i = 0; i < numRecords; i++) {
String dataStr = "testData-" + System.currentTimeMillis();
ByteBuffer data = ByteBuffer.wrap(dataStr.getBytes(StandardCharsets.UTF_8));
String key = String.format("partitionKey-%d", rand.nextLong());
String seqNum = String.format("%04d", 5 * i + 1);
Record record = new Record()
.withData(data)
.withPartitionKey(key)
.withSequenceNumber(seqNum)
.withApproximateArrivalTimestamp(new Date());
records.add(record);
}
return records;
}
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-kinesis
public Record convertToRecord() {
return new Record()
.withApproximateArrivalTimestamp(arrivalTimestamp.toDate())
.withData(ByteBuffer.wrap(data.getBytes(StandardCharsets.UTF_8)))
.withSequenceNumber(sequenceNumber)
.withPartitionKey("");
}
代码示例来源:origin: Nextdoor/bender
public static KinesisEvent createEvent(Class clazz, String resource)
throws UnsupportedEncodingException, IOException {
/*
* Create a kinesis record from a sample JSON file
*/
String json =
IOUtils.toString(new InputStreamReader(clazz.getResourceAsStream(resource), "UTF-8"));
Date approximateArrivalTimestamp = new Date();
approximateArrivalTimestamp.setTime(1478737790000l);
Record rec = new Record();
rec.withPartitionKey("1").withSequenceNumber("2").withData(ByteBuffer.wrap(json.getBytes()))
.withApproximateArrivalTimestamp(approximateArrivalTimestamp);
/*
* Create a KinesisEventRecord and add single Record
*/
KinesisEventRecord krecord = new KinesisEventRecord();
krecord.setKinesis(rec);
krecord.setEventSourceARN("arn:aws:kinesis:us-east-1:1234:stream/test-events-stream");
krecord.setEventID("shardId-000000000000:1234");
/*
* Add single KinesisEventRecord to a KinesisEvent
*/
KinesisEvent kevent = new KinesisEvent();
List<KinesisEventRecord> events = new ArrayList<KinesisEventRecord>(1);
events.add(krecord);
kevent.setRecords(events);
return kevent;
}
内容来源于网络,如有侵权,请联系作者删除!