Skip to content

Comments

feat(forwarder): add SQS support as DLQ backend for failed events#1063

Merged
LorisFriedel merged 6 commits intomasterfrom
loris.friedel/sqs-support-dd-forwarder-OBSPLTF-895
Feb 17, 2026
Merged

feat(forwarder): add SQS support as DLQ backend for failed events#1063
LorisFriedel merged 6 commits intomasterfrom
loris.friedel/sqs-support-dd-forwarder-OBSPLTF-895

Conversation

@LorisFriedel
Copy link
Member

@LorisFriedel LorisFriedel commented Feb 10, 2026

Summary

  • Add AWS SQS as an alternative Dead Letter Queue backend for failed event storage, alongside the existing S3 backend
  • Users set DD_SQS_QUEUE_URL to point to a pre-existing SQS queue; when unset, existing S3 behavior is unchanged
  • Pluggable storage pattern: BaseStorage ABC with S3Storage (renamed from Storage) and new SQSStorage
  • Factory function create_storage() selects backend based on configuration
  • CloudFormation template updated with DdSqsQueueUrl parameter, scoped IAM permissions, and HasStorageBackend condition

SQS design decisions

  • Single queue with MessageAttributes for prefix separation (retry_prefix, function_prefix)
  • Data chunked to fit under SQS 256KB limit (240KB with overhead margin)
  • get_data() polls up to 10 iterations, releases non-matching messages immediately
  • ReceiptHandle used as key for deletion (idempotent)
  • IAM permissions scoped to exact queue ARN (derived from URL via !Split/!Select)

Operational note

When using SQS, the queue's VisibilityTimeout should be >= the Lambda function's Timeout (default 120s) to prevent duplicate processing during retries.


OBSPLTF-947

@github-actions github-actions bot added the aws label Feb 10, 2026
LorisFriedel and others added 3 commits February 16, 2026 10:52
Add AWS SQS as an alternative to S3 for storing failed events during
retry. Users can set DD_SQS_QUEUE_URL to use a pre-existing SQS queue
instead of S3. The implementation uses a pluggable storage backend
pattern with BaseStorage ABC, S3Storage (existing, renamed), and new
SQSStorage. A factory function selects the backend based on config.

SQS design: single queue with MessageAttributes for prefix separation,
data chunked to fit 256KB limit, bounded polling (10 iterations),
idempotent deletion via ReceiptHandle, non-matching messages released
immediately via ChangeMessageVisibility.

CloudFormation template updated with DdSqsQueueUrl parameter, scoped
IAM permissions (ARN derived from queue URL), and HasStorageBackend
condition for DD_STORE_FAILED_EVENTS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The create_storage() factory raised ValueError when neither
DD_SQS_QUEUE_URL nor DD_S3_BUCKET_NAME was configured. This would
crash existing deployments where retry is disabled (the default) but
no storage backend is set — the old Storage() class tolerated this
because S3 API errors only surfaced when storage was actually used.

Fix: always fall back to S3Storage when SQS is not configured,
matching the original behavior. Also add a logger.warning when a
single item exceeds the SQS 240KB chunk limit, to aid debugging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reduce nesting, extract helper, and fix f-string formatting for CI lint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@LorisFriedel LorisFriedel force-pushed the loris.friedel/sqs-support-dd-forwarder-OBSPLTF-895 branch from 751deb8 to b5f37f1 Compare February 16, 2026 10:25
LorisFriedel and others added 2 commits February 16, 2026 14:15
…sage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@LorisFriedel LorisFriedel marked this pull request as ready for review February 16, 2026 21:55
@LorisFriedel LorisFriedel requested a review from a team as a code owner February 16, 2026 21:55
@ViBiOh ViBiOh self-assigned this Feb 17, 2026
…lias

The alias is no longer needed since all production code now uses the
factory method and base class pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@LorisFriedel LorisFriedel merged commit f52fbe7 into master Feb 17, 2026
10 checks passed
@LorisFriedel LorisFriedel deleted the loris.friedel/sqs-support-dd-forwarder-OBSPLTF-895 branch February 17, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants