Repository: getmoto/moto

Issue:
Receive message support for SQS
Hello - why is receive message not supported for SQS? It is one of the core apis. 

Is there a plan to support this in the future?


Discussion:
Nevermind, looks like its supported its just the docs need to be updated.
Hi @adamcyber1, thanks for raising this! I'll reopen this as a reminder for us to fix the documentation :+1: 

Resolving patch:
diff --git a/moto/sqs/models.py b/moto/sqs/models.py
--- a/moto/sqs/models.py
+++ b/moto/sqs/models.py
@@ -544,7 +544,7 @@ def add_message(self, message):
             your function once for each batch. When your function successfully processes
             a batch, Lambda deletes its messages from the queue.
             """
-            messages = backend.receive_messages(
+            messages = backend.receive_message(
                 self.name,
                 esm.batch_size,
                 self.receive_message_wait_time_seconds,
@@ -855,7 +855,7 @@ def _get_first_duplicate_id(self, ids):
             unique_ids.add(_id)
         return None
 
-    def receive_messages(
+    def receive_message(
         self,
         queue_name,
         count,
@@ -863,20 +863,13 @@ def receive_messages(
         visibility_timeout,
         message_attribute_names=None,
     ):
-        """
-        Attempt to retrieve visible messages from a queue.
-
-        If a message was read by client and not deleted it is considered to be
-        "inflight" and cannot be read. We make attempts to obtain ``count``
-        messages but we may return less if messages are in-flight or there
-        are simple not enough messages in the queue.
-
-        :param string queue_name: The name of the queue to read from.
-        :param int count: The maximum amount of messages to retrieve.
-        :param int visibility_timeout: The number of seconds the message should remain invisible to other queue readers.
-        :param int wait_seconds_timeout:  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
-        """
+        # Attempt to retrieve visible messages from a queue.
+
+        # If a message was read by client and not deleted it is considered to be
+        # "inflight" and cannot be read. We make attempts to obtain ``count``
+        # messages but we may return less if messages are in-flight or there
+        # are simple not enough messages in the queue.
+
         if message_attribute_names is None:
             message_attribute_names = []
         queue = self.get_queue(queue_name)
diff --git a/moto/sqs/responses.py b/moto/sqs/responses.py
--- a/moto/sqs/responses.py
+++ b/moto/sqs/responses.py
@@ -423,7 +423,7 @@ def receive_message(self):
         except ValueError:
             return ERROR_MAX_VISIBILITY_TIMEOUT_RESPONSE, dict(status=400)
 
-        messages = self.sqs_backend.receive_messages(
+        messages = self.sqs_backend.receive_message(
             queue_name, message_count, wait_time, visibility_timeout, message_attributes
         )
 


Test patch:
diff --git a/tests/terraform-tests.success.txt b/tests/terraform-tests.success.txt
--- a/tests/terraform-tests.success.txt
+++ b/tests/terraform-tests.success.txt
@@ -145,5 +145,6 @@ TestAccDataSourceAwsEfsMountTarget
 TestAccDataSourceAWSLambdaLayerVersion
 TestAccDataSourceAwsLambdaInvocation
 TestAccDataSourceAwsNetworkInterface_
+TestAccDataSourceAwsSqsQueue
 TestAccDataSourceAWSELB
 TestValidateSSMDocumentPermissions