本文整理了Java中com.amazonaws.services.sqs.model.Message.getAttributes()
方法的一些代码示例,展示了Message.getAttributes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getAttributes()
方法的具体详情如下:
包路径:com.amazonaws.services.sqs.model.Message
类名称:Message
方法名:getAttributes
[英]SenderId
, SentTimestamp
, ApproximateReceiveCount
, and/or ApproximateFirstReceiveTimestamp
. SentTimestamp
and ApproximateFirstReceiveTimestamp
are each returned as an integer representing the epoch time in milliseconds.
[中]SenderId
、SentTimestamp
、ApproximateReceiveCount
和/或ApproximateFirstReceiveTimestamp
。SentTimestamp
和ApproximateFirstReceiveTimestamp
都以整数形式返回,以毫秒为单位表示epoch time。
代码示例来源: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 (getMessageId() != null)
sb.append("MessageId: ").append(getMessageId()).append(",");
if (getReceiptHandle() != null)
sb.append("ReceiptHandle: ").append(getReceiptHandle()).append(",");
if (getMD5OfBody() != null)
sb.append("MD5OfBody: ").append(getMD5OfBody()).append(",");
if (getBody() != null)
sb.append("Body: ").append(getBody()).append(",");
if (getAttributes() != null)
sb.append("Attributes: ").append(getAttributes()).append(",");
if (getMD5OfMessageAttributes() != null)
sb.append("MD5OfMessageAttributes: ").append(getMD5OfMessageAttributes()).append(",");
if (getMessageAttributes() != null)
sb.append("MessageAttributes: ").append(getMessageAttributes());
sb.append("}");
return sb.toString();
}
代码示例来源:origin: aws/aws-sdk-java
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getMessageId() == null) ? 0 : getMessageId().hashCode());
hashCode = prime * hashCode + ((getReceiptHandle() == null) ? 0 : getReceiptHandle().hashCode());
hashCode = prime * hashCode + ((getMD5OfBody() == null) ? 0 : getMD5OfBody().hashCode());
hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode());
hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode());
hashCode = prime * hashCode + ((getMD5OfMessageAttributes() == null) ? 0 : getMD5OfMessageAttributes().hashCode());
hashCode = prime * hashCode + ((getMessageAttributes() == null) ? 0 : getMessageAttributes().hashCode());
return hashCode;
}
代码示例来源:origin: apache/usergrid
message.getAttributes().get( "type" ) );
queueMessage.setStringBody( originalBody );
int receiveCount = Integer.valueOf(message.getAttributes().get("ApproximateReceiveCount"));
queueMessage.setReceiveCount( receiveCount );
queueMessages.add( queueMessage );
代码示例来源:origin: aws/aws-sdk-java
if (other.getBody() != null && other.getBody().equals(this.getBody()) == false)
return false;
if (other.getAttributes() == null ^ this.getAttributes() == null)
return false;
if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false)
return false;
if (other.getMD5OfMessageAttributes() == null ^ this.getMD5OfMessageAttributes() == null)
代码示例来源:origin: apache/nifi
for (final Map.Entry<String, String> entry : message.getAttributes().entrySet()) {
attributes.put("sqs." + entry.getKey(), entry.getValue());
代码示例来源:origin: aws-amplify/aws-sdk-android
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getMessageId() == null) ? 0 : getMessageId().hashCode());
hashCode = prime * hashCode
+ ((getReceiptHandle() == null) ? 0 : getReceiptHandle().hashCode());
hashCode = prime * hashCode + ((getMD5OfBody() == null) ? 0 : getMD5OfBody().hashCode());
hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode());
hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode());
hashCode = prime
* hashCode
+ ((getMD5OfMessageAttributes() == null) ? 0 : getMD5OfMessageAttributes()
.hashCode());
hashCode = prime * hashCode
+ ((getMessageAttributes() == null) ? 0 : getMessageAttributes().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 (getMessageId() != null)
sb.append("MessageId: " + getMessageId() + ",");
if (getReceiptHandle() != null)
sb.append("ReceiptHandle: " + getReceiptHandle() + ",");
if (getMD5OfBody() != null)
sb.append("MD5OfBody: " + getMD5OfBody() + ",");
if (getBody() != null)
sb.append("Body: " + getBody() + ",");
if (getAttributes() != null)
sb.append("Attributes: " + getAttributes() + ",");
if (getMD5OfMessageAttributes() != null)
sb.append("MD5OfMessageAttributes: " + getMD5OfMessageAttributes() + ",");
if (getMessageAttributes() != null)
sb.append("MessageAttributes: " + getMessageAttributes());
sb.append("}");
return sb.toString();
}
代码示例来源:origin: aws-amplify/aws-sdk-android
if (other.getBody() != null && other.getBody().equals(this.getBody()) == false)
return false;
if (other.getAttributes() == null ^ this.getAttributes() == null)
return false;
if (other.getAttributes() != null
&& other.getAttributes().equals(this.getAttributes()) == false)
return false;
if (other.getMD5OfMessageAttributes() == null ^ this.getMD5OfMessageAttributes() == null)
代码示例来源:origin: aws/aws-cloudtrail-processing-library
/**
* Retrieve the CloudTrailSource attributes.
*/
@Override
public Map<String, String> getSourceAttributes() {
return sqsMessage.getAttributes();
}
代码示例来源:origin: skyscreamer/nevado
@Override
public Map<String, String> getAttributes() {
return _message.getAttributes();
}
}
代码示例来源:origin: aws-amplify/aws-sdk-android
request.addParameter(prefix, StringUtils.fromString(body));
if (_message.getAttributes() != null) {
prefix = _prefix + "Attribute";
java.util.Map<String, String> attributes = _message.getAttributes();
int attributesIndex = 1;
String attributesPrefix = prefix + ".";
代码示例来源:origin: spring-cloud/spring-cloud-aws
private static Map<String, Object> getAttributesAsMessageHeaders(com.amazonaws.services.sqs.model.Message message) {
Map<String, Object> messageHeaders = new HashMap<>();
for (Map.Entry<String, String> attributeKeyValuePair : message.getAttributes().entrySet()) {
messageHeaders.put(attributeKeyValuePair.getKey(), attributeKeyValuePair.getValue());
}
return messageHeaders;
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-aws-messaging
private static Map<String, Object> getAttributesAsMessageHeaders(com.amazonaws.services.sqs.model.Message message) {
Map<String, Object> messageHeaders = new HashMap<>();
for (Map.Entry<String, String> attributeKeyValuePair : message.getAttributes().entrySet()) {
messageHeaders.put(attributeKeyValuePair.getKey(), attributeKeyValuePair.getValue());
}
return messageHeaders;
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-amazon-web-services
private Instant getTimestamp(final Message message) {
return new Instant(
Long.parseLong(
message.getAttributes().get(MessageSystemAttributeName.SentTimestamp.toString())));
}
}
代码示例来源:origin: io.macgyver.rx-aws/rx-aws
public static Selector arn(String arn) {
return Selectors.predicate(it -> {
if (it instanceof SQSMessage) {
String arnx = ((SQSMessage) it).getMessage().getAttributes().getOrDefault("arn", null);
if (arnx != null && arnx.equals(arn)) {
return true;
}
}
return false;
});
}
代码示例来源:origin: payara/Cloud-Connectors
@OnSQSMessage
public void receiveMessage(Message message) {
System.out.println("Got message " + message.getBody());
Map<String,MessageAttributeValue> mattrs = message.getMessageAttributes();
for (String key : mattrs.keySet()) {
System.out.println("Got Message attribute " + key + "," + mattrs.get(key).getStringValue());
}
Map<String,String> attrs = message.getAttributes();
for (String key : attrs.keySet()) {
System.out.println("Got attribute " + key + "," + attrs.get(key));
}
}
}
代码示例来源:origin: com.amazonaws/aws-java-sdk-sqs
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getMessageId() == null) ? 0 : getMessageId().hashCode());
hashCode = prime * hashCode + ((getReceiptHandle() == null) ? 0 : getReceiptHandle().hashCode());
hashCode = prime * hashCode + ((getMD5OfBody() == null) ? 0 : getMD5OfBody().hashCode());
hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode());
hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode());
hashCode = prime * hashCode + ((getMD5OfMessageAttributes() == null) ? 0 : getMD5OfMessageAttributes().hashCode());
hashCode = prime * hashCode + ((getMessageAttributes() == null) ? 0 : getMessageAttributes().hashCode());
return hashCode;
}
代码示例来源: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: com.amazonaws/aws-android-sdk-sqs
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getMessageId() == null) ? 0 : getMessageId().hashCode());
hashCode = prime * hashCode
+ ((getReceiptHandle() == null) ? 0 : getReceiptHandle().hashCode());
hashCode = prime * hashCode + ((getMD5OfBody() == null) ? 0 : getMD5OfBody().hashCode());
hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode());
hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode());
hashCode = prime
* hashCode
+ ((getMD5OfMessageAttributes() == null) ? 0 : getMD5OfMessageAttributes()
.hashCode());
hashCode = prime * hashCode
+ ((getMessageAttributes() == null) ? 0 : getMessageAttributes().hashCode());
return hashCode;
}
代码示例来源:origin: pinterest/soundwave
public boolean processMessage(Message msg) {
try {
MessageProcessingResult result = null;
NotificationEvent event =
objectMapper.readValue(msg.getBody(), NotificationEvent.class);
logger.info("Receive event {} with state {} created at {}",
event.getDetail().getInstanceId(),
event.getDetail().getState(), event.getTime());
sqsEventLogger.info(objectMapper.writeValueAsString(event));
Map<String, String> attributes = msg.getAttributes();
if (attributes.containsKey("SentTimestamp")) {
DateTime sentTime = new DateTime(Long.parseLong(attributes.get("SentTimestamp")),
DateTimeZone.UTC);
event.setSqsSentTime(sentTime.toDate());
}
if (handler != null) {
result = handler.processEvent(event);
if (result != null) {
messageProcessingLogger.info(objectMapper.writeValueAsString(result));
return result.isSucceed();
}
}
} catch (Exception e) {
logger.warn("Error Process message:{}", ExceptionUtils.getRootCauseMessage(e));
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!