本文整理了Java中com.amazonaws.services.sqs.model.ReceiveMessageRequest.getReceiveRequestAttemptId
方法的一些代码示例,展示了ReceiveMessageRequest.getReceiveRequestAttemptId
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReceiveMessageRequest.getReceiveRequestAttemptId
方法的具体详情如下:
包路径:com.amazonaws.services.sqs.model.ReceiveMessageRequest
类名称:ReceiveMessageRequest
方法名:getReceiveRequestAttemptId
[英]This parameter applies only to FIFO (first-in-first-out) queues.
The token used for deduplication of ReceiveMessage
calls. If a networking issue occurs after a ReceiveMessage
action, and instead of a response you receive a generic error, you can retry the same action with an identical ReceiveRequestAttemptId
to retrieve the same set of messages, even if their visibility timeout has not yet expired.
ReceiveRequestAttemptId
only for 5 minutes after a ReceiveMessage
action.FifoQueue
, a caller of the ReceiveMessage
action can provide a ReceiveRequestAttemptId
explicitly.ReceiveMessage
action doesn't provide a ReceiveRequestAttemptId
, Amazon SQS generates a ReceiveRequestAttemptId
.ReceiveMessage
action with the same ReceiveRequestAttemptId
if none of the messages have been modified (deleted or had their visibility changes).ReceiveRequestAttemptId
return the same messages and receipt handles. If a retry occurs within the deduplication interval, it resets the visibility timeout. For more information, see Visibility Timeout in the Amazon Simple Queue Service Developer Guide.If a caller of the ReceiveMessage
action still processes messages when the visibility timeout expires and messages become visible, another worker consuming from the same queue can receive the same messages and therefore process duplicates. Also, if a consumer whose message processing time is longer than the visibility timeout tries to delete the processed messages, the action fails with an error.
To mitigate this effect, ensure that your application observes a safe threshold before the visibility timeout expires and extend the visibility timeout as necessary.
MessageGroupId
are invisible, no more messages belonging to the same MessageGroupId
are returned until the visibility timeout expires. You can still receive messages with another MessageGroupId
as long as it is also visible.ReceiveMessage
can't track the ReceiveRequestAttemptId
, no retries work until the original visibility timeout expires. As a result, delays might occur but the messages in the queue remain in a strict order.The length of ReceiveRequestAttemptId
is 128 characters. ReceiveRequestAttemptId
can contain alphanumeric characters (a-z
, A-Z
, 0-9
) and punctuation ( !"#$%&'()*+,-./:;<=>?@[\]^_
{|}~`).
For best practices of using ReceiveRequestAttemptId
, see Using the ReceiveRequestAttemptId Request Parameter in the Amazon Simple Queue Service Developer Guide.
[中]此参数仅适用于FIFO(先进先出)队列。
用于ReceiveMessage
呼叫重复数据消除的令牌。如果在ReceiveMessage
操作后出现网络问题,并且您收到的不是一般错误的响应,而是相同的ReceiveRequestAttemptId
重试相同的操作以检索相同的消息集,即使它们的可见性超时尚未过期。
*在ReceiveMessage
操作后,您只能使用ReceiveRequestAttemptId
5分钟。
*设置FifoQueue
时,ReceiveMessage
操作的调用方可以显式提供ReceiveRequestAttemptId
。
*如果ReceiveMessage
操作的调用方没有提供ReceiveRequestAttemptId
,Amazon SQS将生成ReceiveRequestAttemptId
。
*如果没有任何邮件被修改(删除或可见性发生变化),您可以使用相同的ReceiveRequestAttemptId
重试ReceiveMessage
操作。
*在可见性超时期间,具有相同ReceiveRequestAttemptId
的后续调用将返回相同的消息和接收句柄。如果在重复数据消除间隔内重试,则会重置可见性超时。有关更多信息,请参阅《Amazon简单队列服务开发人员指南》中的{$0$}。
如果ReceiveMessage
操作的调用方在可视性超时过期且消息可见时仍在处理消息,则使用同一队列的另一个工作人员可以接收相同的消息,从而处理重复的消息。此外,如果消息处理时间长于可见性超时的消费者尝试删除已处理的消息,则操作将失败并出现错误。
为了减轻这种影响,请确保应用程序在可见性超时过期之前遵守安全阈值,并根据需要延长可见性超时。
*虽然带有特定MessageGroupId
的邮件是不可见的,但在可见性超时过期之前,不会再返回属于相同MessageGroupId
的邮件。你仍然可以通过另一个MessageGroupId
接收消息,只要它也是可见的。
*如果ReceiveMessage
的调用方无法跟踪ReceiveRequestAttemptId
,则在原始可见性超时过期之前,不会重试。因此,可能会发生延迟,但队列中的消息保持严格的顺序。ReceiveRequestAttemptId
的长度为128个字符。ReceiveRequestAttemptId
可以包含字母数字字符(a-z
、A-Z
、0-9
和标点符号(!"#$%&'()*+,-./:;<=>?@[\]^_
{|}~)。 有关使用
ReceiveRequestAttemptId`的最佳实践,请参阅《Amazon简单队列服务开发人员指南》中的Using the ReceiveRequestAttemptId Request Parameter。
代码示例来源: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.getWaitTimeSeconds() != null && other.getWaitTimeSeconds().equals(this.getWaitTimeSeconds()) == false)
return false;
if (other.getReceiveRequestAttemptId() == null ^ this.getReceiveRequestAttemptId() == null)
return false;
if (other.getReceiveRequestAttemptId() != null && other.getReceiveRequestAttemptId().equals(this.getReceiveRequestAttemptId()) == false)
return false;
return true;
代码示例来源:origin: aws/aws-sdk-java
if (receiveMessageRequest.getReceiveRequestAttemptId() != null) {
request.addParameter("ReceiveRequestAttemptId", StringUtils.fromString(receiveMessageRequest.getReceiveRequestAttemptId()));
代码示例来源: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
&& other.getWaitTimeSeconds().equals(this.getWaitTimeSeconds()) == false)
return false;
if (other.getReceiveRequestAttemptId() == null ^ this.getReceiveRequestAttemptId() == null)
return false;
if (other.getReceiveRequestAttemptId() != null
&& other.getReceiveRequestAttemptId().equals(this.getReceiveRequestAttemptId()) == false)
return false;
return true;
代码示例来源:origin: aws-amplify/aws-sdk-android
request.addParameter(prefix, StringUtils.fromInteger(waitTimeSeconds));
if (receiveMessageRequest.getReceiveRequestAttemptId() != null) {
prefix = "ReceiveRequestAttemptId";
String receiveRequestAttemptId = receiveMessageRequest.getReceiveRequestAttemptId();
request.addParameter(prefix, StringUtils.fromString(receiveRequestAttemptId));
代码示例来源: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-java-sdk-sqs
if (other.getWaitTimeSeconds() != null && other.getWaitTimeSeconds().equals(this.getWaitTimeSeconds()) == false)
return false;
if (other.getReceiveRequestAttemptId() == null ^ this.getReceiveRequestAttemptId() == null)
return false;
if (other.getReceiveRequestAttemptId() != null && other.getReceiveRequestAttemptId().equals(this.getReceiveRequestAttemptId()) == false)
return false;
return true;
代码示例来源:origin: com.amazonaws/aws-android-sdk-sqs
&& other.getWaitTimeSeconds().equals(this.getWaitTimeSeconds()) == false)
return false;
if (other.getReceiveRequestAttemptId() == null ^ this.getReceiveRequestAttemptId() == null)
return false;
if (other.getReceiveRequestAttemptId() != null
&& other.getReceiveRequestAttemptId().equals(this.getReceiveRequestAttemptId()) == false)
return false;
return true;
代码示例来源:origin: com.amazonaws/aws-java-sdk-sqs
if (receiveMessageRequest.getReceiveRequestAttemptId() != null) {
request.addParameter("ReceiveRequestAttemptId", StringUtils.fromString(receiveMessageRequest.getReceiveRequestAttemptId()));
代码示例来源:origin: com.amazonaws/aws-android-sdk-sqs
request.addParameter(prefix, StringUtils.fromInteger(waitTimeSeconds));
if (receiveMessageRequest.getReceiveRequestAttemptId() != null) {
prefix = "ReceiveRequestAttemptId";
String receiveRequestAttemptId = receiveMessageRequest.getReceiveRequestAttemptId();
request.addParameter(prefix, StringUtils.fromString(receiveRequestAttemptId));
内容来源于网络,如有侵权,请联系作者删除!