public static void sendObject(Object objectToSend, StreamName streamName) throws Exception { byte[] bytes = Piping.serialize(objectToSend).getBytes(); PutRecordRequest putRecord = new PutRecordRequest(); putRecord.setStreamName(streamName.toString()); // We use the resource as the partition key so we can accurately calculate totals for a given // resource putRecord.setPartitionKey(objectToSend.toString()); putRecord.setData(ByteBuffer.wrap(bytes)); // Order is not important for this application so we do not send a SequenceNumberForOrdering putRecord.setSequenceNumberForOrdering(null); kinesis.putRecord(putRecord); }
/** * Guarantees strictly increasing sequence numbers, for puts from the same client and to the same * partition key. Usage: set the <code>SequenceNumberForOrdering</code> of record <i>n</i> to the * sequence number of record <i>n-1</i> (as returned in the result when putting record * <i>n-1</i>). If this parameter is not set, records will be coarsely ordered based on arrival * time. * * @param sequenceNumberForOrdering Guarantees strictly increasing sequence numbers, for puts from * the same client and to the same partition key. Usage: set the <code> * SequenceNumberForOrdering</code> of record <i>n</i> to the sequence number of record * <i>n-1</i> (as returned in the result when putting record <i>n-1</i>). If this parameter is * not set, records will be coarsely ordered based on arrival time. * @return Returns a reference to this object so that method calls can be chained together. */ public PutRecordRequest withSequenceNumberForOrdering(String sequenceNumberForOrdering) { setSequenceNumberForOrdering(sequenceNumberForOrdering); return this; }