Skip to main content

Overview

The MessagingFactory creates event-driven AWS resources: SQS queues, SNS topics, and EventBridge event buses. These resources decouple application components for asynchronous communication.

Basic Usage

Messaging Types

SQS Queue (Standard)

Standard queues for high-throughput messaging:
Features:
  • Nearly unlimited throughput
  • At-least-once delivery
  • Best-effort ordering
  • Perfect for background job processing

SQS Queue (FIFO)

FIFO queues for ordered, exactly-once processing:
Features:
  • Exactly-once processing
  • First-in-first-out ordering
  • Message deduplication
  • Perfect for ordered workflows

Dead Letter Queue

Capture failed messages for analysis:

SNS Topic

Publish-subscribe messaging for fan-out patterns:
Features:
  • Fan-out to multiple subscribers
  • Push-based delivery
  • Multiple subscriber types (SQS, Lambda, HTTP, email)
  • Message filtering

EventBridge Event Bus

Custom event bus for event-driven architectures:
Features:
  • Schema registry support
  • Event archiving
  • Cross-account event delivery
  • Rule-based routing

Configuration Parameters

Queue Parameters

Topic Parameters

Event Bus Parameters

Common Patterns

Background Job Processing

Event Fan-Out

Route matching events to multiple targets with an EventBridge event bus. Call subscribe(id, { pattern, target }) on the bus, passing a queue, Lambda, or ECS service as the target. Each subscription creates an EventBridge rule scoped to the bus.
SNS topics support fan-out through publish/subscribe, but Fjall does not yet expose a wrapper subscription method on MessagingFactory topics. Use an EventBridge event bus for declarative fan-out, or attach SNS subscriptions directly to the underlying CDK construct via topic.getTopic().

ISR Revalidation Queue (OpenNext)

Connecting to Compute

Lambda with SQS Trigger

ECS with Queue Access

Access Grants

Queue Permissions

Topic Permissions

Best Practices

  1. Use FIFO queues when order matters
  2. Always configure DLQs for production queues
  3. Set appropriate timeouts based on processing time
  4. Use topics for event broadcasting
  5. Use EventBridge for complex routing rules
  6. Monitor queue depth for scaling decisions

Next Steps

Compute Factory

Process messages with Lambda or ECS

Payload Pattern

See messaging in action with OpenNext