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

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

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

ReceiveMessageRequest.getAttributeNames介绍

[英]A list of s that need to be returned along with each message. These attributes include:

  • All - Returns all values.

  • ApproximateFirstReceiveTimestamp - Returns the time the message was first received from the queue (epoch time in milliseconds).

  • ApproximateReceiveCount - Returns the number of times a message has been received from the queue but not deleted.

  • SenderId

  • For an IAM user, returns the IAM user ID, for example ABCDEFGHI1JKLMNOPQ23R.

    • For an IAM role, returns the IAM role ID, for example ABCDE1F2GH3I4JK5LMNOP:i-a123b456.
  • SentTimestamp - Returns the time the message was sent to the queue (epoch time in milliseconds).

  • MessageDeduplicationId - Returns the value provided by the producer that calls the {{$2$}} action.

  • MessageGroupId - Returns the value provided by the producer that calls the {{$3$}} action. Messages with the same MessageGroupId are returned in sequence.

  • SequenceNumber - Returns the value provided by Amazon SQS.
    [中]需要随每条消息一起返回的消息列表。这些属性包括:
    *All-返回所有值。
    *[$1$]-返回消息第一次从队列接收的时间(epoch time,以毫秒为单位)。
    *ApproximateReceiveCount-返回从队列收到但未删除的消息的次数。

  • SenderId
    *对于IAM用户,返回IAM用户ID,例如[$4$]。
    *对于IAM角色,返回IAM角色ID,例如ABCDE1F2GH3I4JK5LMNOP:i-a123b456
    *[$6$]-返回消息发送到队列的时间(epoch time,以毫秒为单位)。
    *MessageDeduplicationId-返回调用{{$2$}}操作的制作人提供的值。
    *MessageGroupId-返回调用{{$3$}}操作的制作人提供的值。具有相同MessageGroupId的邮件将按顺序返回。
    *[$12$]-返回Amazon SQS提供的值。

代码示例

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

/**
 * @return True if request has been configured to return queue attributes. False otherwise
 */
private boolean hasRequestedQueueAttributes(ReceiveMessageRequest rq) {
  return rq.getAttributeNames() != null && !rq.getAttributeNames().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

attributeNamesCopy.add(value.toString());
if (getAttributeNames() == null) {
  setAttributeNames(attributeNamesCopy);
} else {
  getAttributeNames().addAll(attributeNamesCopy);

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

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

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

if (!receiveMessageRequest.getAttributeNames().isEmpty()
    || !((com.amazonaws.internal.SdkInternalList<String>) receiveMessageRequest.getAttributeNames()).isAutoConstruct()) {
  com.amazonaws.internal.SdkInternalList<String> attributeNamesList = (com.amazonaws.internal.SdkInternalList<String>) receiveMessageRequest
      .getAttributeNames();
  int attributeNamesListIndex = 1;

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

if (getAttributeNames() == null) {
  this.attributeNames = new java.util.ArrayList<String>(attributeNames.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

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

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

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

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

request.addParameter(prefix, StringUtils.fromString(queueUrl));
if (receiveMessageRequest.getAttributeNames() != null) {
  prefix = "AttributeName";
  java.util.List<String> attributeNames = receiveMessageRequest.getAttributeNames();
  int attributeNamesIndex = 1;
  String attributeNamesPrefix = 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

@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

/**
 * 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.getQueueUrl() != null && other.getQueueUrl().equals(this.getQueueUrl()) == false)
  return false;
if (other.getAttributeNames() == null ^ this.getAttributeNames() == null)
  return false;
if (other.getAttributeNames() != null && other.getAttributeNames().equals(this.getAttributeNames()) == false)
  return false;
if (other.getMessageAttributeNames() == null ^ this.getMessageAttributeNames() == null)

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

if (!receiveMessageRequest.getAttributeNames().isEmpty()
    || !((com.amazonaws.internal.SdkInternalList<String>) receiveMessageRequest.getAttributeNames()).isAutoConstruct()) {
  com.amazonaws.internal.SdkInternalList<String> attributeNamesList = (com.amazonaws.internal.SdkInternalList<String>) receiveMessageRequest
      .getAttributeNames();
  int attributeNamesListIndex = 1;

相关文章

微信公众号

最新文章

更多