Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Source: Amazon SQS

The SQS source receives messages from Amazon SQS queues and delivers them into a pg_tide inbox. It uses long polling for efficient message retrieval and deletes messages from SQS only after successful inbox insertion.

Configuration

SELECT tide.relay_set_inbox_v2(
  jsonb_build_object(
    'name', 'events-from-sqs',
    'inbox', 'incoming_events',
    'source', 'sqs',
    'config', '{
        "queue_url": "${env:SQS_QUEUE_URL}",
        "region": "us-east-1",
        "wait_time_seconds": 20,
        "visibility_timeout": 60,
        "batch_size": 10
    }'::jsonb
  )
);

Configuration Reference

ParameterTypeDefaultDescription
source_typestring—Must be "sqs"
queue_urlstring—SQS queue URL
regionstring—AWS region
wait_time_secondsint20Long poll wait time (max 20)
visibility_timeoutint60Seconds before unprocessed messages become visible again
batch_sizeint10Messages per ReceiveMessage call (max 10)
access_key_idstringnullAWS credentials (optional, falls back to default chain)
secret_access_keystringnullAWS secret key

Delivery Guarantees

Messages are deleted from SQS only after inbox insertion succeeds. The inbox's deduplication uses the SQS message ID, making Standard-queue redelivery safe at the database boundary. FIFO deduplication is bounded by the queue's configured window; relay transport remains at least once.

Further Reading