Title: No response in SQSMessageSuccess while detecting faces inside a video uploaded on Amazon s3
Tags: java;amazon-web-services;amazon-s3;amazon-sqs
Question: I had been trying to detect faces from a video stored on Amazon S3, the faces have to be matched against the collection that has the faces which are to be searched for in the video. 
I have used Amazon VideoDetect.
My piece of code, goes like this:

```CreateCollection createCollection = new CreateCollection(collection);
createCollection.makeCollection();
AddFacesToCollection addFacesToCollection = new AddFacesToCollection(collection, bucketName, image);
addFacesToCollection.addFaces();
VideoDetect videoDetect = new VideoDetect(video, bucketName, collection);
videoDetect.CreateTopicandQueue();
try {
  videoDetect.StartFaceSearchCollection(bucketName, video, collection);
  if (videoDetect.GetSQSMessageSuccess())
    videoDetect.GetFaceSearchCollectionResults();
} catch (Exception e) {
  e.printStackTrace();
  return false;
}
videoDetect.DeleteTopicandQueue();
return true;
```

The things seem to work fine till StartFaceSearchCollection and I am getting a jobId being made and a queue as well. But when it is trying to go around to get GetSQSMessageSuccess, its never returning me any message. 
The code which is trying to fetch the message is :

```   ReceiveMessageRequest.Builder receiveMessageRequest = ReceiveMessageRequest.builder().queueUrl(sqsQueueUrl);
   messages = sqs.receiveMessage(receiveMessageRequest.build()).messages();
```

Its having the correct sqsQueueUrl which exist. But I am not getting anything in the message. 
On timeout its giving me this exception : 

```software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: sqs.region.amazonaws.com
    at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:97)   

Caused by: java.net.UnknownHostException: sqs.region.amazonaws.com
```

So is there any alternative to this, instead of SQSMessage, can we track/poll the jobId any other way ?? Or I am missing out on anything ??



Here is another answer: The simple working code snippet to receive SQS message with the valid sqsQueueUrl  for more

```ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(sqsQueueUrl);
final List<Message&gt; messages = sqs.receiveMessage(receiveMessageRequest).getMessages();
for (final Message message : messages) {
    System.out.println("Message");
    System.out.println("  MessageId:     " + message.getMessageId());
    System.out.println("  ReceiptHandle: " + message.getReceiptHandle());
    System.out.println("  MD5OfBody:     " + message.getMD5OfBody());
    System.out.println("  Body:          " + message.getBody());
    for (final Entry<String, String&gt; entry : message.getAttributes().entrySet()) {
        System.out.println("Attribute");
        System.out.println("  Name:  " + entry.getKey());
        System.out.println("  Value: " + entry.getValue());
    }
}
System.out.println();
```

Comment for this answer: Hi,the first line of code ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(sqsQueueUrl); is not returning me any value,and hence the messages are also not available although I have the queue as well as the jobId and the sqsQueueUrl specified is correct.
Comment for this answer: Its showing Messages Available (Visible) as 0. What could be the reason of these messages being 0 ?
Comment for this answer: On timeout its giving me this exception: software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: sqs..amazonaws.com
 at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:97)
 
Caused by: java.net.UnknownHostException: sqs..amazonaws.com
Comment for this answer: @Preksha, have you checked the Amazon Management console? In SQS Section -> select your topic -> Details -> Messages Available (Visible) and check the messages are present or not. Because if the sqsQueueUrl is correct and the region values are correct, then definitely there is no change of any hiccups in the pipeline communication
Comment for this answer: You can configure the Amazon SQS message retention period to a value from 1 minute to 14 days. The default is 4 days. Once the message retention limit is reached, your messages are automatically deleted. That's why the reason for "0" messages. Are you sure using https://sqs.{region}.amazonaws.com/{account-id}/{QueueName}? because the error message clearly elucidates that the  URL is unreachable. you can make sure to URL by visiting SQS Section -> select your topic -> Details -> URL(your sqsQueueUrl)

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:01/15/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<java><amazon-web-services><amazon-s3><amazon-sqs>', 'Title': 'No response in SQSMessageSuccess while detecting faces inside a video uploaded on Amazon s3', 'ViewCount': 134, 'id': 59748783, 'user_AboutMe': None, 'user_AccountId': 17532952.0, 'user_DisplayName': 'Preksha', 'user_Reputation': 1.0, 'user_Views': 0.0, 'user_id': 12716645.0}}