com.amazonaws.services.sqs.model.Message.getMD5OfMessageAttributes()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(15.3k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中com.amazonaws.services.sqs.model.Message.getMD5OfMessageAttributes()方法的一些代码示例,展示了Message.getMD5OfMessageAttributes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getMD5OfMessageAttributes()方法的具体详情如下:
包路径:com.amazonaws.services.sqs.model.Message
类名称:Message
方法名:getMD5OfMessageAttributes

Message.getMD5OfMessageAttributes介绍

[英]An MD5 digest of the non-URL-encoded message attribute string. This can be used to verify that Amazon SQS received the message correctly. Amazon SQS first URL decodes the message before creating the MD5 digest. For information about MD5, see RFC1321.
[中]

代码示例

代码示例来源: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: aws/aws-sdk-java

/**
 * Throw an exception if the MD5 checksums included in the ReceiveMessageResult do not match the
 * client-side calculation on the received messages.
 */
private static void receiveMessageResultMd5Check(ReceiveMessageResult receiveMessageResult) {
  if (receiveMessageResult.getMessages() != null) {
    for (Message messageReceived : receiveMessageResult.getMessages()) {
      String messageBody = messageReceived.getBody();
      String bodyMd5Returned = messageReceived.getMD5OfBody();
      String clientSideBodyMd5 = calculateMessageBodyMd5(messageBody);
      if (!clientSideBodyMd5.equals(bodyMd5Returned)) {
        throw new AmazonClientException(String.format(MD5_MISMATCH_ERROR_MESSAGE, MESSAGE_BODY,
            clientSideBodyMd5, bodyMd5Returned));
      }
      Map<String, MessageAttributeValue> messageAttr = messageReceived.getMessageAttributes();
      if (messageAttr != null && !messageAttr.isEmpty()) {
        String attrMd5Returned = messageReceived.getMD5OfMessageAttributes();
        String clientSideAttrMd5 = calculateMessageAttributesMd5(messageAttr);
        if (!clientSideAttrMd5.equals(attrMd5Returned)) {
          throw new AmazonClientException(String.format(MD5_MISMATCH_ERROR_MESSAGE, MESSAGE_ATTRIBUTES,
              clientSideAttrMd5, attrMd5Returned));
        }
      }
    }
  }
}

代码示例来源:origin: aws/aws-sdk-java

if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false)
  return false;
if (other.getMD5OfMessageAttributes() == null ^ this.getMD5OfMessageAttributes() == null)
  return false;
if (other.getMD5OfMessageAttributes() != null && other.getMD5OfMessageAttributes().equals(this.getMD5OfMessageAttributes()) == false)
  return false;
if (other.getMessageAttributes() == null ^ this.getMessageAttributes() == null)

代码示例来源: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

/**
 * Throw an exception if the MD5 checksums included in the
 * ReceiveMessageResult do not match the client-side calculation on the
 * received messages.
 */
private static void receiveMessageResultMd5Check(ReceiveMessageResult receiveMessageResult) {
  if (receiveMessageResult.getMessages() != null) {
    for (Message messageReceived : receiveMessageResult.getMessages()) {
      String messageBody = messageReceived.getBody();
      String bodyMd5Returned = messageReceived.getMD5OfBody();
      String clientSideBodyMd5 = calculateMessageBodyMd5(messageBody);
      if (!clientSideBodyMd5.equals(bodyMd5Returned)) {
        throw new AmazonClientException(String.format(
            MD5_MISMATCH_ERROR_MESSAGE, MESSAGE_BODY,
            clientSideBodyMd5, bodyMd5Returned));
      }
      Map<String, MessageAttributeValue> messageAttr = messageReceived
          .getMessageAttributes();
      if (messageAttr != null && !messageAttr.isEmpty()) {
        String attrMd5Returned = messageReceived.getMD5OfMessageAttributes();
        String clientSideAttrMd5 = calculateMessageAttributesMd5(messageAttr);
        if (!clientSideAttrMd5.equals(attrMd5Returned)) {
          throw new AmazonClientException(String.format(
              MD5_MISMATCH_ERROR_MESSAGE, MESSAGE_ATTRIBUTES,
              clientSideAttrMd5, attrMd5Returned));
        }
      }
    }
  }
}

代码示例来源:origin: aws-amplify/aws-sdk-android

&& other.getAttributes().equals(this.getAttributes()) == false)
  return false;
if (other.getMD5OfMessageAttributes() == null ^ this.getMD5OfMessageAttributes() == null)
  return false;
if (other.getMD5OfMessageAttributes() != null
    && other.getMD5OfMessageAttributes().equals(this.getMD5OfMessageAttributes()) == false)
  return false;
if (other.getMessageAttributes() == null ^ this.getMessageAttributes() == null)

代码示例来源:origin: aws-amplify/aws-sdk-android

if (_message.getMD5OfMessageAttributes() != null) {
  prefix = _prefix + "MD5OfMessageAttributes";
  String mD5OfMessageAttributes = _message.getMD5OfMessageAttributes();
  request.addParameter(prefix, StringUtils.fromString(mD5OfMessageAttributes));

代码示例来源:origin: com.amazonaws/aws-java-sdk-sqs

/**
 * 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: 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: 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: com.amazonaws/aws-android-sdk-sqs

/**
 * 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: Comcast/cmb

public CQSMessage(Message message) {
  
  this.messageId = message.getMessageId();
  this.receiptHandle = message.getReceiptHandle();
  this.body = message.getBody();
  this.mD5OfBody = message.getMD5OfBody();
  
  this.messageAttributes = new HashMap<String, CQSMessageAttribute>();
  
  for (String messageAttributeName : message.getMessageAttributes().keySet()) {
    MessageAttributeValue messageAttributeValue = message.getMessageAttributes().get(messageAttributeName);
    CQSMessageAttribute ma = new CQSMessageAttribute(messageAttributeValue.getStringValue(), messageAttributeValue.getDataType());
    this.messageAttributes.put(messageAttributeName, ma);
  }
  
  this.md5OfMessageAttributes = message.getMD5OfMessageAttributes();
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-sqs

/**
 * Throw an exception if the MD5 checksums included in the ReceiveMessageResult do not match the
 * client-side calculation on the received messages.
 */
private static void receiveMessageResultMd5Check(ReceiveMessageResult receiveMessageResult) {
  if (receiveMessageResult.getMessages() != null) {
    for (Message messageReceived : receiveMessageResult.getMessages()) {
      String messageBody = messageReceived.getBody();
      String bodyMd5Returned = messageReceived.getMD5OfBody();
      String clientSideBodyMd5 = calculateMessageBodyMd5(messageBody);
      if (!clientSideBodyMd5.equals(bodyMd5Returned)) {
        throw new AmazonClientException(String.format(MD5_MISMATCH_ERROR_MESSAGE, MESSAGE_BODY,
            clientSideBodyMd5, bodyMd5Returned));
      }
      Map<String, MessageAttributeValue> messageAttr = messageReceived.getMessageAttributes();
      if (messageAttr != null && !messageAttr.isEmpty()) {
        String attrMd5Returned = messageReceived.getMD5OfMessageAttributes();
        String clientSideAttrMd5 = calculateMessageAttributesMd5(messageAttr);
        if (!clientSideAttrMd5.equals(attrMd5Returned)) {
          throw new AmazonClientException(String.format(MD5_MISMATCH_ERROR_MESSAGE, MESSAGE_ATTRIBUTES,
              clientSideAttrMd5, attrMd5Returned));
        }
      }
    }
  }
}

代码示例来源:origin: com.amazonaws/aws-android-sdk-sqs

/**
 * Throw an exception if the MD5 checksums included in the
 * ReceiveMessageResult do not match the client-side calculation on the
 * received messages.
 */
private static void receiveMessageResultMd5Check(ReceiveMessageResult receiveMessageResult) {
  if (receiveMessageResult.getMessages() != null) {
    for (Message messageReceived : receiveMessageResult.getMessages()) {
      String messageBody = messageReceived.getBody();
      String bodyMd5Returned = messageReceived.getMD5OfBody();
      String clientSideBodyMd5 = calculateMessageBodyMd5(messageBody);
      if (!clientSideBodyMd5.equals(bodyMd5Returned)) {
        throw new AmazonClientException(String.format(
            MD5_MISMATCH_ERROR_MESSAGE, MESSAGE_BODY,
            clientSideBodyMd5, bodyMd5Returned));
      }
      Map<String, MessageAttributeValue> messageAttr = messageReceived
          .getMessageAttributes();
      if (messageAttr != null && !messageAttr.isEmpty()) {
        String attrMd5Returned = messageReceived.getMD5OfMessageAttributes();
        String clientSideAttrMd5 = calculateMessageAttributesMd5(messageAttr);
        if (!clientSideAttrMd5.equals(attrMd5Returned)) {
          throw new AmazonClientException(String.format(
              MD5_MISMATCH_ERROR_MESSAGE, MESSAGE_ATTRIBUTES,
              clientSideAttrMd5, attrMd5Returned));
        }
      }
    }
  }
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-sqs

if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false)
  return false;
if (other.getMD5OfMessageAttributes() == null ^ this.getMD5OfMessageAttributes() == null)
  return false;
if (other.getMD5OfMessageAttributes() != null && other.getMD5OfMessageAttributes().equals(this.getMD5OfMessageAttributes()) == false)
  return false;
if (other.getMessageAttributes() == null ^ this.getMessageAttributes() == null)

代码示例来源:origin: com.amazonaws/aws-android-sdk-sqs

&& other.getAttributes().equals(this.getAttributes()) == false)
  return false;
if (other.getMD5OfMessageAttributes() == null ^ this.getMD5OfMessageAttributes() == null)
  return false;
if (other.getMD5OfMessageAttributes() != null
    && other.getMD5OfMessageAttributes().equals(this.getMD5OfMessageAttributes()) == false)
  return false;
if (other.getMessageAttributes() == null ^ this.getMessageAttributes() == null)

代码示例来源:origin: com.amazonaws/aws-android-sdk-sqs

if (_message.getMD5OfMessageAttributes() != null) {
  prefix = _prefix + "MD5OfMessageAttributes";
  String mD5OfMessageAttributes = _message.getMD5OfMessageAttributes();
  request.addParameter(prefix, StringUtils.fromString(mD5OfMessageAttributes));

相关文章