本文整理了Java中com.amazonaws.services.sqs.model.Message.addAttributesEntry()
方法的一些代码示例,展示了Message.addAttributesEntry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.addAttributesEntry()
方法的具体详情如下:
包路径:com.amazonaws.services.sqs.model.Message
类名称:Message
方法名:addAttributesEntry
[英]SenderId
, SentTimestamp
, ApproximateReceiveCount
, and/or ApproximateFirstReceiveTimestamp
. SentTimestamp
and ApproximateFirstReceiveTimestamp
are each returned as an integer representing the epoch time in milliseconds.
The method adds a new key-value pair into Attributes parameter, and returns a reference to this object so that method calls can be chained together.
[中]SenderId
、SentTimestamp
、ApproximateReceiveCount
和/或ApproximateFirstReceiveTimestamp
。SentTimestamp
和ApproximateFirstReceiveTimestamp
都以整数形式返回,以毫秒为单位表示epoch time。
该方法将新的键值对添加到Attributes参数中,并返回对此对象的引用,以便将方法调用链接在一起。
代码示例来源:origin: aws/aws-sdk-java
message.addAttributesEntry(entry.getKey(), entry.getValue());
continue;
代码示例来源:origin: aws/aws-cloudtrail-processing-library
/**
* Excluding S3_BUCKET, S3_OBJECT_KEY, add all other attributes from the message body to <code>sqsMessage</code>.
* @param sqsMessage The SQS message.
* @param messageNode The message body.
*/
private void addRestMessageAttributes(Message sqsMessage, JsonNode messageNode) {
Iterator<String> it = messageNode.fieldNames();
while(it.hasNext()) {
String key = it.next();
if (!key.equals(S3_OBJECT_KEY) && !key.equals(S3_BUCKET_NAME)) {
sqsMessage.addAttributesEntry(key, messageNode.get(key).textValue());
}
}
}
代码示例来源:origin: aws-amplify/aws-sdk-android
Entry<String, String> entry = AttributesMapEntryUnmarshaller.getInstance()
.unmarshall(context);
message.addAttributesEntry(entry.getKey(), entry.getValue());
continue;
代码示例来源:origin: aws/aws-cloudtrail-processing-library
@Override
public CloudTrailSource getSource(Message sqsMessage) throws IOException {
if (messageExtractor.getMessageText(sqsMessage).equals(CLOUD_TRAIL_VALIDATION_MESSAGE)) {
sqsMessage.addAttributesEntry(SourceAttributeKeys.SOURCE_TYPE.getAttributeKey(), SourceType.CloudTrailValidationMessage.name());
return new SQSBasedSource(sqsMessage, null);
}
return null;
}
}
代码示例来源:origin: aws/aws-cloudtrail-processing-library
/**
* Add the account ID attribute to the <code>sqsMessage</code> if it does not exist.
* @param sqsMessage The SQS message.
* @param s3ObjectKey The S3 object key.
*/
public static void setMessageAccountId(Message sqsMessage, String s3ObjectKey) {
if (!sqsMessage.getAttributes().containsKey(SourceAttributeKeys.ACCOUNT_ID.getAttributeKey())) {
String accountId = extractAccountIdFromObjectKey(s3ObjectKey);
if (accountId != null) {
sqsMessage.addAttributesEntry(SourceAttributeKeys.ACCOUNT_ID.getAttributeKey(), accountId);
}
}
}
代码示例来源:origin: aws/aws-cloudtrail-processing-library
/**
* As long as there is at least one CloudTrail log object:
* <p>
* <li>Add the CloudTrail log object key to the list.</li>
* <li>Add <code>accountId</code> extracted from log object key to <code>sqsMessage</code>.</li>
* <li>Add {@link SourceType#CloudTrailLog} to the <code>sqsMessage</code>.</li>
* </p>
*
* If there is no CloudTrail log object and it is a valid CloudTrail message, CPL adds only {@link SourceType#Other}
* to the <code>sqsMessage</code>.
*
*/
private void addCloudTrailLogsAndMessageAttributes(Message sqsMessage, List<CloudTrailLog> cloudTrailLogs, JsonNode messageNode) throws IOException {
SourceType sourceType = SourceType.Other;
String bucketName = messageNode.get(S3_BUCKET_NAME).textValue();
List<String> objectKeys = mapper.readValue(messageNode.get(S3_OBJECT_KEY).traverse(), new TypeReference<List<String>>() {});
for (String objectKey: objectKeys) {
SourceType currSourceType = sourceIdentifier.identify(objectKey);
if (currSourceType == SourceType.CloudTrailLog) {
cloudTrailLogs.add(new CloudTrailLog(bucketName, objectKey));
sourceType = currSourceType;
LibraryUtils.setMessageAccountId(sqsMessage, objectKey);
}
}
sqsMessage.addAttributesEntry(SourceAttributeKeys.SOURCE_TYPE.getAttributeKey(), sourceType.name());
}
代码示例来源:origin: aws/aws-cloudtrail-processing-library
sqsMessage.addAttributesEntry(SourceAttributeKeys.SOURCE_TYPE.getAttributeKey(), sourceType.name());
代码示例来源:origin: com.amazonaws/aws-java-sdk-sqs
message.addAttributesEntry(entry.getKey(), entry.getValue());
continue;
代码示例来源:origin: com.amazonaws/aws-android-sdk-sqs
Entry<String, String> entry = AttributesMapEntryUnmarshaller.getInstance()
.unmarshall(context);
message.addAttributesEntry(entry.getKey(), entry.getValue());
continue;
内容来源于网络,如有侵权,请联系作者删除!