本文整理了Java中com.amazonaws.services.kinesis.model.Record.withPartitionKey
方法的一些代码示例,展示了Record.withPartitionKey
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.withPartitionKey
方法的具体详情如下:
包路径:com.amazonaws.services.kinesis.model.Record
类名称:Record
方法名:withPartitionKey
[英]Identifies which shard in the stream the data record is assigned to.
[中]
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-kinesis
private List<Record> generateRecords(int num) {
List<Record> records = new ArrayList<>();
for (int i = 0; i < num; i++) {
byte[] value = new byte[1024];
Arrays.fill(value, (byte) i);
records.add(
new Record()
.withSequenceNumber(String.valueOf(i))
.withPartitionKey("key")
.withData(ByteBuffer.wrap(value)));
}
return records;
}
}
代码示例来源: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: com.amazonaws/amazon-kinesis-client
Record record = new Record()
.withData(ByteBuffer.wrap(mr.getData().toByteArray()))
.withPartitionKey(partitionKey)
.withSequenceNumber(r.getSequenceNumber())
.withApproximateArrivalTimestamp(aat < 0 ? null : new Date(aat));
代码示例来源: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: spring-projects/spring-integration-aws
.withNextShardIterator(null)
.withRecords(new Record()
.withPartitionKey("partition1")
.withSequenceNumber("1")
.withData(ByteBuffer.wrap("foo".getBytes()))));
代码示例来源:origin: spring-projects/spring-integration-aws
.withNextShardIterator(shard1Iterator3)
.withRecords(new Record()
.withPartitionKey("partition1")
.withSequenceNumber("1")
.withData(ByteBuffer.wrap(serializingConverter.convert("foo"))),
new Record()
.withPartitionKey("partition1")
.withSequenceNumber("2")
.withData(ByteBuffer.wrap(serializingConverter.convert("bar")))));
.withNextShardIterator(shard1Iterator3)
.withRecords(new Record()
.withPartitionKey("partition1")
.withSequenceNumber("2")
.withData(ByteBuffer.wrap(serializingConverter.convert("bar")))));
内容来源于网络,如有侵权,请联系作者删除!