本文整理了Java中com.amazonaws.services.sqs.model.ReceiveMessageRequest.setWaitTimeSeconds
方法的一些代码示例,展示了ReceiveMessageRequest.setWaitTimeSeconds
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReceiveMessageRequest.setWaitTimeSeconds
方法的具体详情如下:
包路径:com.amazonaws.services.sqs.model.ReceiveMessageRequest
类名称:ReceiveMessageRequest
方法名:setWaitTimeSeconds
[英]The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a message is available, the call returns sooner than WaitTimeSeconds
. If no messages are available and the wait time expires, the call returns successfully with an empty list of messages.
[中]呼叫在返回之前等待消息到达队列的持续时间(秒)。如果有消息,则通话会在[$0$]之前返回。如果没有可用消息且等待时间到期,则呼叫将成功返回,消息列表为空。
代码示例来源:origin: aws/aws-sdk-java
/**
* <p>
* The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a
* message is available, the call returns sooner than <code>WaitTimeSeconds</code>. If no messages are available and
* the wait time expires, the call returns successfully with an empty list of messages.
* </p>
*
* @param waitTimeSeconds
* The duration (in seconds) for which the call waits for a message to arrive in the queue before returning.
* If a message is available, the call returns sooner than <code>WaitTimeSeconds</code>. If no messages are
* available and the wait time expires, the call returns successfully with an empty list of messages.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReceiveMessageRequest withWaitTimeSeconds(Integer waitTimeSeconds) {
setWaitTimeSeconds(waitTimeSeconds);
return this;
}
代码示例来源:origin: apache/usergrid
receiveMessageRequest.setWaitTimeSeconds( longPollTimeout / 1000 ); // convert to seconds
代码示例来源:origin: apache/nifi
request.setVisibilityTimeout(context.getProperty(VISIBILITY_TIMEOUT).asTimePeriod(TimeUnit.SECONDS).intValue());
request.setQueueUrl(queueUrl);
request.setWaitTimeSeconds(context.getProperty(RECEIVE_MSG_WAIT_TIME).asTimePeriod(TimeUnit.SECONDS).intValue());
代码示例来源:origin: com.amazonaws/aws-java-sdk-sqs
/**
* <p>
* The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a
* message is available, the call returns sooner than <code>WaitTimeSeconds</code>. If no messages are available and
* the wait time expires, the call returns successfully with an empty list of messages.
* </p>
*
* @param waitTimeSeconds
* The duration (in seconds) for which the call waits for a message to arrive in the queue before returning.
* If a message is available, the call returns sooner than <code>WaitTimeSeconds</code>. If no messages are
* available and the wait time expires, the call returns successfully with an empty list of messages.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReceiveMessageRequest withWaitTimeSeconds(Integer waitTimeSeconds) {
setWaitTimeSeconds(waitTimeSeconds);
return this;
}
代码示例来源:origin: io.macgyver.rx-aws/rx-aws
@Override
public void run() {
while (isRunning()) {
try {
ReceiveMessageRequest request = new ReceiveMessageRequest();
request.setQueueUrl(getQueueUrl());
request.setAttributeNames(ImmutableList.of("ALL"));
request.setWaitTimeSeconds(waitTimeSeconds);
Future<ReceiveMessageResult> result = client.receiveMessageAsync(request, new Handler());
result.get(); // go ahead and block
} catch (Exception e) {
logger.warn("", e);
failureCount.incrementAndGet();
}
try {
long rescheduleDelay = Math.min(60000, 1000 * failureCount.get() * 3);
if (rescheduleDelay > 0) {
logger.info("pausing for {}ms due to errors", rescheduleDelay);
Thread.sleep(rescheduleDelay);
}
} catch (InterruptedException e) {
// swallow it
}
}
}
代码示例来源:origin: payara/Cloud-Connectors
rmr.setMaxNumberOfMessages(spec.getMaxMessages());
rmr.setVisibilityTimeout(spec.getVisibilityTimeout());
rmr.setWaitTimeSeconds(spec.getPollInterval()/1000);
rmr.setAttributeNames(Arrays.asList(spec.getAttributeNames().split(",")));
rmr.setMessageAttributeNames(Arrays.asList(spec.getMessageAttributeNames().split(",")));
代码示例来源:origin: Comcast/cmb
receiveMessageRequest.setWaitTimeSeconds(waitTimeSeconds);
代码示例来源:origin: pinterest/soundwave
request.withAttributeNames("All");
request.setWaitTimeSeconds(10); //Long polling
boolean processedMessage;
do {
代码示例来源:origin: bitsofinfo/s3-bucket-loader
req.setWaitTimeSeconds(10);
req.setMaxNumberOfMessages(10);
req.setVisibilityTimeout(300);
代码示例来源:origin: bitsofinfo/s3-bucket-loader
req.setWaitTimeSeconds(10);
req.setQueueUrl(this.tocQueueUrl);
代码示例来源:origin: spring-cloud/spring-cloud-aws
public ReceiveMessageRequest getReceiveMessageRequest() {
ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(this.destinationUrl).
withAttributeNames(RECEIVING_ATTRIBUTES).
withMessageAttributeNames(RECEIVING_MESSAGE_ATTRIBUTES);
if (this.maxNumberOfMessages != null) {
receiveMessageRequest.withMaxNumberOfMessages(this.maxNumberOfMessages);
} else {
receiveMessageRequest.withMaxNumberOfMessages(DEFAULT_MAX_NUMBER_OF_MESSAGES);
}
if (this.visibilityTimeout != null) {
receiveMessageRequest.withVisibilityTimeout(this.visibilityTimeout);
}
if (this.waitTimeOut != null) {
receiveMessageRequest.setWaitTimeSeconds(this.waitTimeOut);
}
return receiveMessageRequest;
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-aws-messaging
public ReceiveMessageRequest getReceiveMessageRequest() {
ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(this.destinationUrl).
withAttributeNames(RECEIVING_ATTRIBUTES).
withMessageAttributeNames(RECEIVING_MESSAGE_ATTRIBUTES);
if (this.maxNumberOfMessages != null) {
receiveMessageRequest.withMaxNumberOfMessages(this.maxNumberOfMessages);
} else {
receiveMessageRequest.withMaxNumberOfMessages(DEFAULT_MAX_NUMBER_OF_MESSAGES);
}
if (this.visibilityTimeout != null) {
receiveMessageRequest.withVisibilityTimeout(this.visibilityTimeout);
}
if (this.waitTimeOut != null) {
receiveMessageRequest.setWaitTimeSeconds(this.waitTimeOut);
}
return receiveMessageRequest;
}
代码示例来源:origin: aws/aws-cloudtrail-processing-library
/**
* Poll SQS queue for incoming messages, filter them, and return a list of SQS Messages.
*
* @return a list of SQS messages.
*/
public List<Message> pollQueue() {
boolean success = false;
ProgressStatus pollQueueStatus = new ProgressStatus(ProgressState.pollQueue, new BasicPollQueueInfo(0, success));
final Object reportObject = progressReporter.reportStart(pollQueueStatus);
ReceiveMessageRequest request = new ReceiveMessageRequest().withAttributeNames(ALL_ATTRIBUTES);
request.setQueueUrl(config.getSqsUrl());
request.setVisibilityTimeout(config.getVisibilityTimeout());
request.setMaxNumberOfMessages(DEFAULT_SQS_MESSAGE_SIZE_LIMIT);
request.setWaitTimeSeconds(DEFAULT_WAIT_TIME_SECONDS);
List<Message> sqsMessages = new ArrayList<Message>();
try {
ReceiveMessageResult result = sqsClient.receiveMessage(request);
sqsMessages = result.getMessages();
logger.info("Polled " + sqsMessages.size() + " sqs messages from " + config.getSqsUrl());
success = true;
} catch (AmazonServiceException e) {
LibraryUtils.handleException(exceptionHandler, pollQueueStatus, e, "Failed to poll sqs message.");
} finally {
LibraryUtils.endToProcess(progressReporter, success, pollQueueStatus, reportObject);
}
return sqsMessages;
}
代码示例来源:origin: org.apache.nifi/nifi-aws-processors
request.setVisibilityTimeout(context.getProperty(VISIBILITY_TIMEOUT).asTimePeriod(TimeUnit.SECONDS).intValue());
request.setQueueUrl(queueUrl);
request.setWaitTimeSeconds(context.getProperty(RECEIVE_MSG_WAIT_TIME).asTimePeriod(TimeUnit.SECONDS).intValue());
内容来源于网络,如有侵权,请联系作者删除!