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

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

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

ReceiveMessageRequest.getMessageAttributeNames介绍

[英]The name of the message attribute, where N is the index.

  • The name can contain alphanumeric characters and the underscore (_), hyphen (-), and period (.).
  • The name is case-sensitive and must be unique among all attribute names for the message.
  • The name must not start with AWS-reserved prefixes such as AWS. or Amazon. (or any casing variants).
  • The name must not start or end with a period (.), and it should not have periods in succession ( ..).
  • The name can be up to 256 characters long.

When using ReceiveMessage, you can send a list of attribute names to receive, or you can return all of the attributes by specifying All or .* in your request. You can also use all message attributes starting with a prefix, for example bar.*.
[中]消息属性的名称,其中N是索引。
*名称可以包含字母数字字符和下划线(_、连字符(-)和句点(.)。
*名称区分大小写,并且在消息的所有属性名称中必须是唯一的。
*名称不得以AWS保留前缀开头,例如AWS.Amazon.(或任何大小写变体)。
*名称不得以句点(.开头或结尾,且不应连续出现句点(..)。
*名称最长可达256个字符。
使用ReceiveMessage时,可以发送要接收的属性名称列表,也可以通过在请求中指定All.*返回所有属性。您还可以使用以前缀开头的所有消息属性,例如bar.*

代码示例

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

/**
 * @return True if request has been configured to return message attributes. False otherwise
 */
private boolean hasRequestedMessageAttributes(ReceiveMessageRequest rq) {
  return rq.getMessageAttributeNames() != null && !rq.getMessageAttributeNames().isEmpty();
}

代码示例来源: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 (getQueueUrl() != null)
    sb.append("QueueUrl: ").append(getQueueUrl()).append(",");
  if (getAttributeNames() != null)
    sb.append("AttributeNames: ").append(getAttributeNames()).append(",");
  if (getMessageAttributeNames() != null)
    sb.append("MessageAttributeNames: ").append(getMessageAttributeNames()).append(",");
  if (getMaxNumberOfMessages() != null)
    sb.append("MaxNumberOfMessages: ").append(getMaxNumberOfMessages()).append(",");
  if (getVisibilityTimeout() != null)
    sb.append("VisibilityTimeout: ").append(getVisibilityTimeout()).append(",");
  if (getWaitTimeSeconds() != null)
    sb.append("WaitTimeSeconds: ").append(getWaitTimeSeconds()).append(",");
  if (getReceiveRequestAttemptId() != null)
    sb.append("ReceiveRequestAttemptId: ").append(getReceiveRequestAttemptId());
  sb.append("}");
  return sb.toString();
}

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

@Override
public int hashCode() {
  final int prime = 31;
  int hashCode = 1;
  hashCode = prime * hashCode + ((getQueueUrl() == null) ? 0 : getQueueUrl().hashCode());
  hashCode = prime * hashCode + ((getAttributeNames() == null) ? 0 : getAttributeNames().hashCode());
  hashCode = prime * hashCode + ((getMessageAttributeNames() == null) ? 0 : getMessageAttributeNames().hashCode());
  hashCode = prime * hashCode + ((getMaxNumberOfMessages() == null) ? 0 : getMaxNumberOfMessages().hashCode());
  hashCode = prime * hashCode + ((getVisibilityTimeout() == null) ? 0 : getVisibilityTimeout().hashCode());
  hashCode = prime * hashCode + ((getWaitTimeSeconds() == null) ? 0 : getWaitTimeSeconds().hashCode());
  hashCode = prime * hashCode + ((getReceiveRequestAttemptId() == null) ? 0 : getReceiveRequestAttemptId().hashCode());
  return hashCode;
}

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

if (other.getAttributeNames() != null && other.getAttributeNames().equals(this.getAttributeNames()) == false)
  return false;
if (other.getMessageAttributeNames() == null ^ this.getMessageAttributeNames() == null)
  return false;
if (other.getMessageAttributeNames() != null && other.getMessageAttributeNames().equals(this.getMessageAttributeNames()) == false)
  return false;
if (other.getMaxNumberOfMessages() == null ^ this.getMaxNumberOfMessages() == null)

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

if (!receiveMessageRequest.getMessageAttributeNames().isEmpty()
    || !((com.amazonaws.internal.SdkInternalList<String>) receiveMessageRequest.getMessageAttributeNames()).isAutoConstruct()) {
  com.amazonaws.internal.SdkInternalList<String> messageAttributeNamesList = (com.amazonaws.internal.SdkInternalList<String>) receiveMessageRequest
      .getMessageAttributeNames();
  int messageAttributeNamesListIndex = 1;

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

if (getMessageAttributeNames() == null) {
  this.messageAttributeNames = new java.util.ArrayList<String>(
      messageAttributeNames.length);

代码示例来源: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 (getQueueUrl() != null)
    sb.append("QueueUrl: " + getQueueUrl() + ",");
  if (getAttributeNames() != null)
    sb.append("AttributeNames: " + getAttributeNames() + ",");
  if (getMessageAttributeNames() != null)
    sb.append("MessageAttributeNames: " + getMessageAttributeNames() + ",");
  if (getMaxNumberOfMessages() != null)
    sb.append("MaxNumberOfMessages: " + getMaxNumberOfMessages() + ",");
  if (getVisibilityTimeout() != null)
    sb.append("VisibilityTimeout: " + getVisibilityTimeout() + ",");
  if (getWaitTimeSeconds() != null)
    sb.append("WaitTimeSeconds: " + getWaitTimeSeconds() + ",");
  if (getReceiveRequestAttemptId() != null)
    sb.append("ReceiveRequestAttemptId: " + getReceiveRequestAttemptId());
  sb.append("}");
  return sb.toString();
}

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

@Override
public int hashCode() {
  final int prime = 31;
  int hashCode = 1;
  hashCode = prime * hashCode + ((getQueueUrl() == null) ? 0 : getQueueUrl().hashCode());
  hashCode = prime * hashCode
      + ((getAttributeNames() == null) ? 0 : getAttributeNames().hashCode());
  hashCode = prime
      * hashCode
      + ((getMessageAttributeNames() == null) ? 0 : getMessageAttributeNames().hashCode());
  hashCode = prime * hashCode
      + ((getMaxNumberOfMessages() == null) ? 0 : getMaxNumberOfMessages().hashCode());
  hashCode = prime * hashCode
      + ((getVisibilityTimeout() == null) ? 0 : getVisibilityTimeout().hashCode());
  hashCode = prime * hashCode
      + ((getWaitTimeSeconds() == null) ? 0 : getWaitTimeSeconds().hashCode());
  hashCode = prime
      * hashCode
      + ((getReceiveRequestAttemptId() == null) ? 0 : getReceiveRequestAttemptId()
          .hashCode());
  return hashCode;
}

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

/**
 * Submits a request to receive some messages from SQS.
 *
 * @return a Future object that will be notified when the operation is
 *         completed; never null;
 */
public Future<ReceiveMessageResult> receiveMessage(ReceiveMessageRequest rq,
    AsyncHandler<ReceiveMessageRequest, ReceiveMessageResult> handler) {
  // only handle simple requests, because these are the settings we
  // pre-fetch with
  boolean noAttributes = (rq.getAttributeNames() == null) || rq.getAttributeNames().isEmpty();
  boolean noMessageAttributesToRetrieve = (rq.getMessageAttributeNames() == null)
      || rq.getMessageAttributeNames().isEmpty();
  boolean bufferngEnabled = (config.getMaxInflightReceiveBatches() > 0)
      && (config.getMaxDoneReceiveBatches() > 0);
  if (noMessageAttributesToRetrieve && noAttributes && bufferngEnabled
      && (rq.getVisibilityTimeout() == null)) {
    QueueBufferCallback<ReceiveMessageRequest, ReceiveMessageResult> callback = null;
    if (handler != null) {
      callback = new QueueBufferCallback<ReceiveMessageRequest, ReceiveMessageResult>(
          handler, rq);
    }
    QueueBufferFuture<ReceiveMessageRequest, ReceiveMessageResult> future = receiveBuffer
        .receiveMessageAsync(rq, callback);
    future.setBuffer(this);
    return future;
  } else {
    return realSqs.receiveMessageAsync(rq);
  }
}

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

&& other.getAttributeNames().equals(this.getAttributeNames()) == false)
  return false;
if (other.getMessageAttributeNames() == null ^ this.getMessageAttributeNames() == null)
  return false;
if (other.getMessageAttributeNames() != null
    && other.getMessageAttributeNames().equals(this.getMessageAttributeNames()) == false)
  return false;
if (other.getMaxNumberOfMessages() == null ^ this.getMaxNumberOfMessages() == null)

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

/**
 * @return True if request has been configured to return message attributes. False otherwise
 */
private boolean hasRequestedMessageAttributes(ReceiveMessageRequest rq) {
  return rq.getMessageAttributeNames() != null && !rq.getMessageAttributeNames().isEmpty();
}

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

if (receiveMessageRequest.getMessageAttributeNames() != null) {
  prefix = "MessageAttributeName";
  java.util.List<String> messageAttributeNames = receiveMessageRequest
      .getMessageAttributeNames();
  int messageAttributeNamesIndex = 1;
  String messageAttributeNamesPrefix = prefix;

代码示例来源: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 (getQueueUrl() != null)
    sb.append("QueueUrl: ").append(getQueueUrl()).append(",");
  if (getAttributeNames() != null)
    sb.append("AttributeNames: ").append(getAttributeNames()).append(",");
  if (getMessageAttributeNames() != null)
    sb.append("MessageAttributeNames: ").append(getMessageAttributeNames()).append(",");
  if (getMaxNumberOfMessages() != null)
    sb.append("MaxNumberOfMessages: ").append(getMaxNumberOfMessages()).append(",");
  if (getVisibilityTimeout() != null)
    sb.append("VisibilityTimeout: ").append(getVisibilityTimeout()).append(",");
  if (getWaitTimeSeconds() != null)
    sb.append("WaitTimeSeconds: ").append(getWaitTimeSeconds()).append(",");
  if (getReceiveRequestAttemptId() != null)
    sb.append("ReceiveRequestAttemptId: ").append(getReceiveRequestAttemptId());
  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 + ((getQueueUrl() == null) ? 0 : getQueueUrl().hashCode());
  hashCode = prime * hashCode + ((getAttributeNames() == null) ? 0 : getAttributeNames().hashCode());
  hashCode = prime * hashCode + ((getMessageAttributeNames() == null) ? 0 : getMessageAttributeNames().hashCode());
  hashCode = prime * hashCode + ((getMaxNumberOfMessages() == null) ? 0 : getMaxNumberOfMessages().hashCode());
  hashCode = prime * hashCode + ((getVisibilityTimeout() == null) ? 0 : getVisibilityTimeout().hashCode());
  hashCode = prime * hashCode + ((getWaitTimeSeconds() == null) ? 0 : getWaitTimeSeconds().hashCode());
  hashCode = prime * hashCode + ((getReceiveRequestAttemptId() == null) ? 0 : getReceiveRequestAttemptId().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 (getQueueUrl() != null)
    sb.append("QueueUrl: " + getQueueUrl() + ",");
  if (getAttributeNames() != null)
    sb.append("AttributeNames: " + getAttributeNames() + ",");
  if (getMessageAttributeNames() != null)
    sb.append("MessageAttributeNames: " + getMessageAttributeNames() + ",");
  if (getMaxNumberOfMessages() != null)
    sb.append("MaxNumberOfMessages: " + getMaxNumberOfMessages() + ",");
  if (getVisibilityTimeout() != null)
    sb.append("VisibilityTimeout: " + getVisibilityTimeout() + ",");
  if (getWaitTimeSeconds() != null)
    sb.append("WaitTimeSeconds: " + getWaitTimeSeconds() + ",");
  if (getReceiveRequestAttemptId() != null)
    sb.append("ReceiveRequestAttemptId: " + getReceiveRequestAttemptId());
  sb.append("}");
  return sb.toString();
}

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

@Override
public int hashCode() {
  final int prime = 31;
  int hashCode = 1;
  hashCode = prime * hashCode + ((getQueueUrl() == null) ? 0 : getQueueUrl().hashCode());
  hashCode = prime * hashCode
      + ((getAttributeNames() == null) ? 0 : getAttributeNames().hashCode());
  hashCode = prime
      * hashCode
      + ((getMessageAttributeNames() == null) ? 0 : getMessageAttributeNames().hashCode());
  hashCode = prime * hashCode
      + ((getMaxNumberOfMessages() == null) ? 0 : getMaxNumberOfMessages().hashCode());
  hashCode = prime * hashCode
      + ((getVisibilityTimeout() == null) ? 0 : getVisibilityTimeout().hashCode());
  hashCode = prime * hashCode
      + ((getWaitTimeSeconds() == null) ? 0 : getWaitTimeSeconds().hashCode());
  hashCode = prime
      * hashCode
      + ((getReceiveRequestAttemptId() == null) ? 0 : getReceiveRequestAttemptId()
          .hashCode());
  return hashCode;
}

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

/**
 * Submits a request to receive some messages from SQS.
 *
 * @return a Future object that will be notified when the operation is
 *         completed; never null;
 */
public Future<ReceiveMessageResult> receiveMessage(ReceiveMessageRequest rq,
    AsyncHandler<ReceiveMessageRequest, ReceiveMessageResult> handler) {
  // only handle simple requests, because these are the settings we
  // pre-fetch with
  boolean noAttributes = (rq.getAttributeNames() == null) || rq.getAttributeNames().isEmpty();
  boolean noMessageAttributesToRetrieve = (rq.getMessageAttributeNames() == null)
      || rq.getMessageAttributeNames().isEmpty();
  boolean bufferngEnabled = (config.getMaxInflightReceiveBatches() > 0)
      && (config.getMaxDoneReceiveBatches() > 0);
  if (noMessageAttributesToRetrieve && noAttributes && bufferngEnabled
      && (rq.getVisibilityTimeout() == null)) {
    QueueBufferCallback<ReceiveMessageRequest, ReceiveMessageResult> callback = null;
    if (handler != null) {
      callback = new QueueBufferCallback<ReceiveMessageRequest, ReceiveMessageResult>(
          handler, rq);
    }
    QueueBufferFuture<ReceiveMessageRequest, ReceiveMessageResult> future = receiveBuffer
        .receiveMessageAsync(rq, callback);
    future.setBuffer(this);
    return future;
  } else {
    return realSqs.receiveMessageAsync(rq);
  }
}

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

if (other.getAttributeNames() != null && other.getAttributeNames().equals(this.getAttributeNames()) == false)
  return false;
if (other.getMessageAttributeNames() == null ^ this.getMessageAttributeNames() == null)
  return false;
if (other.getMessageAttributeNames() != null && other.getMessageAttributeNames().equals(this.getMessageAttributeNames()) == false)
  return false;
if (other.getMaxNumberOfMessages() == null ^ this.getMaxNumberOfMessages() == null)

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

&& other.getAttributeNames().equals(this.getAttributeNames()) == false)
  return false;
if (other.getMessageAttributeNames() == null ^ this.getMessageAttributeNames() == null)
  return false;
if (other.getMessageAttributeNames() != null
    && other.getMessageAttributeNames().equals(this.getMessageAttributeNames()) == false)
  return false;
if (other.getMaxNumberOfMessages() == null ^ this.getMaxNumberOfMessages() == null)

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

if (!receiveMessageRequest.getMessageAttributeNames().isEmpty()
    || !((com.amazonaws.internal.SdkInternalList<String>) receiveMessageRequest.getMessageAttributeNames()).isAutoConstruct()) {
  com.amazonaws.internal.SdkInternalList<String> messageAttributeNamesList = (com.amazonaws.internal.SdkInternalList<String>) receiveMessageRequest
      .getMessageAttributeNames();
  int messageAttributeNamesListIndex = 1;

相关文章

微信公众号

最新文章

更多