本文整理了Java中com.amazonaws.services.kinesis.model.Record.getSequenceNumber
方法的一些代码示例,展示了Record.getSequenceNumber
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.getSequenceNumber
方法的具体详情如下:
包路径:com.amazonaws.services.kinesis.model.Record
类名称:Record
方法名:getSequenceNumber
[英]The unique identifier of the record within its shard.
[中]记录碎片中记录的唯一标识符。
代码示例来源:origin: apache/storm
private void emitNewRecord (SpoutOutputCollector collector) {
for (Map.Entry<String, LinkedList<Record>> entry: toEmitPerShard.entrySet()) {
String shardId = entry.getKey();
LinkedList<Record> listOfRecords = entry.getValue();
Record record;
while ((record = listOfRecords.pollFirst()) != null) {
KinesisMessageId kinesisMessageId = new KinesisMessageId(kinesisConfig.getStreamName(), shardId, record.getSequenceNumber());
if (emitRecord(collector, record, kinesisMessageId)) {
return;
}
}
}
}
代码示例来源:origin: apache/storm
} else {
entry.getValue().addAll(records);
fetchedSequenceNumberPerShard.put(shardId, records.get(records.size() - 1).getSequenceNumber());
代码示例来源:origin: aws/aws-sdk-java
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getSequenceNumber() == null) ? 0 : getSequenceNumber().hashCode());
hashCode = prime * hashCode + ((getApproximateArrivalTimestamp() == null) ? 0 : getApproximateArrivalTimestamp().hashCode());
hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode());
hashCode = prime * hashCode + ((getPartitionKey() == null) ? 0 : getPartitionKey().hashCode());
hashCode = prime * hashCode + ((getEncryptionType() == null) ? 0 : getEncryptionType().hashCode());
return hashCode;
}
代码示例来源:origin: apache/storm
private boolean emitRecord (SpoutOutputCollector collector, Record record, KinesisMessageId kinesisMessageId) {
boolean result = false;
List<Object> tuple = kinesisConfig.getRecordToTupleMapper().getTuple(record);
// if a record is returned put the sequence number in the emittedPerShard to tie back with ack or fail
if (tuple != null && tuple.size() > 0) {
collector.emit(tuple, kinesisMessageId);
if (!emittedPerShard.containsKey(kinesisMessageId.getShardId())) {
emittedPerShard.put(kinesisMessageId.getShardId(), new TreeSet<BigInteger>());
}
emittedPerShard.get(kinesisMessageId.getShardId()).add(new BigInteger(record.getSequenceNumber()));
result = true;
} else {
// ack to not process the record again on restart and move on to next message
LOG.warn("Record " + record + " did not return a tuple to emit. Hence acking it");
ack(kinesisMessageId);
}
return result;
}
代码示例来源:origin: aws/aws-sdk-java
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getSequenceNumber() != null)
sb.append("SequenceNumber: ").append(getSequenceNumber()).append(",");
if (getApproximateArrivalTimestamp() != null)
sb.append("ApproximateArrivalTimestamp: ").append(getApproximateArrivalTimestamp()).append(",");
if (getData() != null)
sb.append("Data: ").append(getData()).append(",");
if (getPartitionKey() != null)
sb.append("PartitionKey: ").append(getPartitionKey()).append(",");
if (getEncryptionType() != null)
sb.append("EncryptionType: ").append(getEncryptionType());
sb.append("}");
return sb.toString();
}
代码示例来源:origin: apache/storm
KinesisMessageId current = new KinesisMessageId(kinesisMessageId.getStreamName(), kinesisMessageId.getShardId(), record.getSequenceNumber());
if (failedPerShard.get(kinesisMessageId.getShardId()).contains(new BigInteger(current.getSequenceNumber()))) {
failedandFetchedRecords.put(current, record);
代码示例来源:origin: aws/aws-sdk-java
return false;
Record other = (Record) obj;
if (other.getSequenceNumber() == null ^ this.getSequenceNumber() == null)
return false;
if (other.getSequenceNumber() != null && other.getSequenceNumber().equals(this.getSequenceNumber()) == false)
return false;
if (other.getApproximateArrivalTimestamp() == null ^ this.getApproximateArrivalTimestamp() == null)
代码示例来源:origin: apache/incubator-druid
return records.get(0).getSequenceNumber();
代码示例来源:origin: aws/aws-sdk-java
/**
* Marshall the given parameter object.
*/
public void marshall(Record record, ProtocolMarshaller protocolMarshaller) {
if (record == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(record.getSequenceNumber(), SEQUENCENUMBER_BINDING);
protocolMarshaller.marshall(record.getApproximateArrivalTimestamp(), APPROXIMATEARRIVALTIMESTAMP_BINDING);
protocolMarshaller.marshall(record.getData(), DATA_BINDING);
protocolMarshaller.marshall(record.getPartitionKey(), PARTITIONKEY_BINDING);
protocolMarshaller.marshall(record.getEncryptionType(), ENCRYPTIONTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
代码示例来源:origin: apache/incubator-druid
streamPartition.getStream(),
streamPartition.getPartitionId(),
kinesisRecord.getSequenceNumber(),
data
);
代码示例来源:origin: aws-amplify/aws-sdk-android
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getSequenceNumber() == null) ? 0 : getSequenceNumber().hashCode());
hashCode = prime
* hashCode
+ ((getApproximateArrivalTimestamp() == null) ? 0
: getApproximateArrivalTimestamp().hashCode());
hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode());
hashCode = prime * hashCode
+ ((getPartitionKey() == null) ? 0 : getPartitionKey().hashCode());
hashCode = prime * hashCode
+ ((getEncryptionType() == null) ? 0 : getEncryptionType().hashCode());
return hashCode;
}
代码示例来源:origin: aws-amplify/aws-sdk-android
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getSequenceNumber() != null)
sb.append("SequenceNumber: " + getSequenceNumber() + ",");
if (getApproximateArrivalTimestamp() != null)
sb.append("ApproximateArrivalTimestamp: " + getApproximateArrivalTimestamp() + ",");
if (getData() != null)
sb.append("Data: " + getData() + ",");
if (getPartitionKey() != null)
sb.append("PartitionKey: " + getPartitionKey() + ",");
if (getEncryptionType() != null)
sb.append("EncryptionType: " + getEncryptionType());
sb.append("}");
return sb.toString();
}
代码示例来源:origin: aws-amplify/aws-sdk-android
Record other = (Record) obj;
if (other.getSequenceNumber() == null ^ this.getSequenceNumber() == null)
return false;
if (other.getSequenceNumber() != null
&& other.getSequenceNumber().equals(this.getSequenceNumber()) == false)
return false;
if (other.getApproximateArrivalTimestamp() == null
代码示例来源:origin: aws-amplify/aws-sdk-android
public void marshall(Record record, AwsJsonWriter jsonWriter) throws Exception {
jsonWriter.beginObject();
if (record.getSequenceNumber() != null) {
String sequenceNumber = record.getSequenceNumber();
jsonWriter.name("SequenceNumber");
jsonWriter.value(sequenceNumber);
}
if (record.getApproximateArrivalTimestamp() != null) {
java.util.Date approximateArrivalTimestamp = record.getApproximateArrivalTimestamp();
jsonWriter.name("ApproximateArrivalTimestamp");
jsonWriter.value(approximateArrivalTimestamp);
}
if (record.getData() != null) {
java.nio.ByteBuffer data = record.getData();
jsonWriter.name("Data");
jsonWriter.value(data);
}
if (record.getPartitionKey() != null) {
String partitionKey = record.getPartitionKey();
jsonWriter.name("PartitionKey");
jsonWriter.value(partitionKey);
}
if (record.getEncryptionType() != null) {
String encryptionType = record.getEncryptionType();
jsonWriter.name("EncryptionType");
jsonWriter.value(encryptionType);
}
jsonWriter.endObject();
}
代码示例来源:origin: amazon-archives/kinesis-storm-spout
private void removeNodeAndUpdateCheckpoint(RecordNode node) {
if (recordNodeList.getFirst() == node) {
checkpointSequenceNumber = node.getRecord().getSequenceNumber();
}
recordNodeList.remove(node);
seqNumToRecordInfoMap.remove(node.getRecord().getSequenceNumber());
}
代码示例来源:origin: com.amazonaws/amazon-kinesis-connectors
private void filterAndBufferRecord(T transformedRecord, Record record) {
if (filter.keepRecord(transformedRecord)) {
buffer.consumeRecord(transformedRecord, record.getData().array().length, record.getSequenceNumber());
}
}
代码示例来源:origin: awslabs/amazon-kinesis-connectors
private void filterAndBufferRecord(T transformedRecord, Record record) {
if (filter.keepRecord(transformedRecord)) {
buffer.consumeRecord(transformedRecord, record.getData().array().length, record.getSequenceNumber());
}
}
代码示例来源:origin: apache/samza
private IncomingMessageEnvelope translate(SystemStreamPartition ssp, Record record) {
String shardId = processors.get(ssp).getShardId();
byte[] payload = new byte[record.getData().remaining()];
metrics.updateMetrics(ssp.getStream(), record);
record.getData().get(payload);
KinesisSystemConsumerOffset offset = new KinesisSystemConsumerOffset(shardId, record.getSequenceNumber());
return new KinesisIncomingMessageEnvelope(ssp, offset.toString(), record.getPartitionKey(),
payload, shardId, record.getSequenceNumber(), record.getApproximateArrivalTimestamp());
}
代码示例来源:origin: com.amazonaws/amazon-kinesis-client
@Override
public GetRecordsResult accept() {
nextIterator = result.getNextShardIterator();
if (!CollectionUtils.isNullOrEmpty(result.getRecords())) {
lastKnownSequenceNumber = Iterables.getLast(result.getRecords()).getSequenceNumber();
}
if (nextIterator == null) {
isShardEndReached = true;
}
return getResult();
}
代码示例来源:origin: apache/samza
private void verifyOffset(String offset, Record inputRecord, String shardId) {
KinesisSystemConsumerOffset ckpt = KinesisSystemConsumerOffset.parse(offset);
Assert.assertEquals(ckpt.getSeqNumber(), inputRecord.getSequenceNumber());
Assert.assertEquals(ckpt.getShardId(), shardId);
}
内容来源于网络,如有侵权,请联系作者删除!