Java Code Examples for com.amazonaws.services.kinesis.model.Record#setApproximateArrivalTimestamp()
The following examples show how to use
com.amazonaws.services.kinesis.model.Record#setApproximateArrivalTimestamp() .
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: MockKinesisClient.java From presto with Apache License 2.0 | 6 votes |
public PutRecordResult putRecord(ByteBuffer data, String partitionKey) { // Create record and insert into the shards. Initially just do it // on a round robin basis. long timestamp = System.currentTimeMillis() - 50000; Record record = new Record(); record = record.withData(data).withPartitionKey(partitionKey).withSequenceNumber(String.valueOf(sequenceNo)); record.setApproximateArrivalTimestamp(new Date(timestamp)); if (nextShard == shards.size()) { nextShard = 0; } InternalShard shard = shards.get(nextShard); shard.addRecord(record); PutRecordResult result = new PutRecordResult(); result.setSequenceNumber(String.valueOf(sequenceNo)); result.setShardId(shard.getShardId()); nextShard++; sequenceNo++; return result; }
Example 2
Source File: MockKinesisClient.java From presto-kinesis with Apache License 2.0 | 6 votes |
public PutRecordResult putRecord(ByteBuffer data, String partitionKey) { // Create record and insert into the shards. Initially just do it // on a round robin basis. long ts = System.currentTimeMillis() - 50000; Record rec = new Record(); rec = rec.withData(data).withPartitionKey(partitionKey).withSequenceNumber(String.valueOf(sequenceNo)); rec.setApproximateArrivalTimestamp(new Date(ts)); if (nextShard == shards.size()) { nextShard = 0; } InternalShard shard = shards.get(nextShard); shard.addRecord(rec); PutRecordResult result = new PutRecordResult(); result.setSequenceNumber(String.valueOf(sequenceNo)); result.setShardId(shard.getShardId()); nextShard++; sequenceNo++; return result; }
Example 3
Source File: TestDirectDeaggregation.java From kinesis-aggregation with Apache License 2.0 | 5 votes |
@Test public void testAggregatedRecord() { // create a new KinesisEvent.Record from the aggregated data Record r = new Record(); r.setPartitionKey(aggregated.getPartitionKey()); r.setApproximateArrivalTimestamp(new Date(System.currentTimeMillis())); r.setData(ByteBuffer.wrap(aggregated.toRecordBytes())); // deaggregate the record List<UserRecord> userRecords = deaggregator.deaggregate(Arrays.asList(r)); assertEquals("Deaggregated Count Matches", aggregated.getNumUserRecords(), userRecords.size()); verifyOneToOneMapping(userRecords); }