Search in sources :

Example 1 with UserRecord

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);
    }
}
Also used : UserRecord(com.amazonaws.services.kinesis.producer.UserRecord) DateTime(org.joda.time.DateTime)

Example 2 with UserRecord

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;
}
Also used : UserRecord(com.amazonaws.services.kinesis.producer.UserRecord) ArrayList(java.util.ArrayList) UserRecordResult(com.amazonaws.services.kinesis.producer.UserRecordResult)

Aggregations

UserRecord (com.amazonaws.services.kinesis.producer.UserRecord)2 UserRecordResult (com.amazonaws.services.kinesis.producer.UserRecordResult)1 ArrayList (java.util.ArrayList)1 DateTime (org.joda.time.DateTime)1