Receive a message
from platonic.sqs.queue import SQSReceiver from platonic.timeout import ConstantTimeout from datetime import timedelta incoming_numbers = SQSReceiver[int]( url='https://sqs.us-west-2.amazonaws.com/123456789012/queue-name', # Thus we prevent the receiver from blocking forever if queue is empty timeout=ConstantTimeout(period=timedelta(minutes=3)), ) # If the queue is empty, this call with block until there is a message. cmd = incoming_numbers.receive() assert cmd.value == 15 # Do complicated stuff with the value print(cmd.value * 1234 + 5767)
The message will appear again in the queue after visibility timeout expires, and you will receive it again, if you do not acknowledge the message after successful processing.
Fetch one message from the queue.
If the queue is empty, by default block forever until a message arrives.
timeout argument of
SQSReceiver class to see how to change that.
id field of
Message class is provided with
property of the received message. This is a non-global identifier
which is necessary to delete the message from the queue using