Messaging - Queues

1. System Context

Developers use Nitric to define required message queues within their application.

  • App code uses the Queue resource from the Nitric SDK.
  • Developers define queues their application requires and implement application logic to send or receive messages.

Operations use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud.

Example AWS Provider
  • AWS SQS serves as the message queuing service.
  • AWS IAM provides roles and policies for secure access to SQS queues.
Code
Terraform
Create SQS Queue
Access SQS Queue
Provide Access
Developer
Operations
nitric up
AWS SQS Queue
AWS Lambda Functions
AWS IAM
Example GCP Provider
  • Google Pub/Sub Topic serves as the message queuing service.
  • Google Pub/Sub Subscription emulates a queue by creating a pull subscription for the topic.
Code
Terraform
Create Pub/Sub Topic
Pull Messages
Developer
Operations
nitric up
Google Pub/Sub Topic
Google Pub/Sub Subscription

2. Sequence

ClientNitric SDKNitric RuntimeCloud Queue Service (e.g., AWS SQS, GCP Pub/Sub)alt[Successful Operation][Failure]Send or receive message from queueForward queue API callPerform queue operation (e.g., enqueue, dequeue)Return result (e.g., message or success status)Return resultReturn result to clientReturn errorForward errorReturn error responseClientNitric SDKNitric RuntimeCloud Queue Service (e.g., AWS SQS, GCP Pub/Sub)

3. Component

Queue Module

  • Ensures the deployment of a scalable, provider-agnostic message queue with a consistent naming convention for seamless integration.
  • Configures metadata or tags for resource identification, governance, and management.
  • Implements secure access by dynamically assigning permissions to applications or services, enforcing the principle of least privilege.
  • Supports configurable event-driven workflows, enabling the integration of producer-consumer patterns and worker pipelines.
  • Provides dynamic configurations to handle varying workloads and queue-specific parameters such as message retention, delivery delay, and dead-letter queues.
  • Abstracts the underlying queuing infrastructure, allowing developers and operations teams to focus on messaging logic rather than provider-specific APIs.

4. Code

Developers write application code that uses the Queue resource from the SDK, configures the secret, and implements the application logic to access and manage secrets.

SDK Reference by language -

Operations will use or extend the Nitric Terraform reference modules:

Last updated on Feb 4, 2025