Reputation: 192
Hi I am developing an application in Java that parses documents using AWS Textract. For multipage parse I use the startDocumentAnalysis method available on the textract client. This client then responds with a jobId and the jobId is placed on the sqs queue along with it's completion status. I had a personal account previously and managed to get all of it working so a process reads messages from the queue and then get the result of the parse using :
GetDocumentAnalysisRequest documentAnalysisRequest = GetDocumentAnalysisRequest.builder().jobId(jobId)
.maxResults(maxResults).nextToken(paginationToken).build();
Now i have to do that on my company's AWS account and i have retraced my steps and everything works except now when i go to pick up the messages from the queue, all the messages come back as [] i.e. empty array. I use this code:
messages = sqsClient.receiveMessage(receiveMessageRequest).messages();
So i know the error can't be in the java code because previously it worked. I also know that i can upload to the new bucket and also do single page parses, so i know my credentials are correct. I have created a topic on sns and registered my sqs to it but somewhere here there must be a permission or other configuration error. Maybe SNS and SQS are not talking to each other?
Wonder if anyone has any insights that could help me. Thank you
Upvotes: 1
Views: 1795
Reputation: 192
I found the answer. It's all to do with the naming convention of the SNS topic. Explained in the documentation:
https://docs.aws.amazon.com/textract/latest/dg/api-async-roles.html
Step3 - Create an Amazon SNS topic. Prepend the topic name with AmazonTextract. Note the topic Amazon Resource Name (ARN). Ensure that the topic is in the same Region as the AWS endpoint that you're using.
Upvotes: 3