我的程序在 SQS 队列中创建了一条消息,然后需要等待其中一名工作人员在队列上拉动工作来处理它。我想监视一条消息的状态以确定它何时被删除,因为那将是我工作完成的指标。但我想不出用 SQS API 做到这一点的方法。
SendMessageRequest msgRequest = new SendMessageRequest(SQS_QUEUE_URL, messageBody);
SendMessageResult result = sqsClient.sendMessage(msgRequest);
String msgId = result.getMessageId();
// so, in theory, this is what I WANT to do...
while(!sqsClient.wasThisMessageDeletedYet(msgId))
Thread.sleep(1000L);
// continue, confident that because the message was deleted, I can rely upon the fact that the result of the Worker is now stashed where it's supposed to be
执行“wasThisMessageDeletedYet(id)”的正确方法是什么?