use of com.amazonaws.services.kinesis.producer.UserRecord in project beam by apache.
the class KinesisProducerMock method flush.
@Override
public synchronized void flush() {
DateTime arrival = DateTime.now();
for (int i = 0; i < addedRecords.size(); i++) {
UserRecord record = addedRecords.get(i);
arrival = arrival.plusSeconds(1);
kinesisService.addShardedData(record.getData(), arrival);
addedRecords.remove(i);
}
}
use of com.amazonaws.services.kinesis.producer.UserRecord in project beam by apache.
the class KinesisProducerMock method addUserRecord.
@Override
public synchronized ListenableFuture<UserRecordResult> addUserRecord(String stream, String partitionKey, String explicitHashKey, ByteBuffer data) {
seqNumber.incrementAndGet();
SettableFuture<UserRecordResult> f = SettableFuture.create();
f.set(new UserRecordResult(new ArrayList<>(), String.valueOf(seqNumber.get()), explicitHashKey, !isFailedFlush));
if (kinesisService.getExistedStream().equals(stream)) {
addedRecords.add(new UserRecord(stream, partitionKey, explicitHashKey, data));
}
return f;
}
Aggregations