Messaging - Topics
1. System Context
Developers use Nitric to define required topics to enable event-driven communication within their application.
- App code interacts with the Topic resource through defined topics and subscriptions.
- Developers define topics their application requires and implement application logic to publish or subscribe to messages.
Operations use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud.
Example AWS Provider
- AWS SNS (Simple Notification Service) serves as the messaging and event notification service.
- AWS Lambda functions are subscribed to SNS topics to process incoming messages.
- AWS IAM manages roles and policies for secure access to SNS topics and Lambda functions.
- AWS Step Functions make it possible to delay or schedule notifications, batch jobs, or any process that requires a timed pause before continuing with a task.
Example GCP Provider
- Google Pub/Sub serves as the messaging and event notification service.
- Google Cloud Run services are subscribed to Pub/Sub topics to process incoming messages.
- Google IAM manages roles and policies for secure access to Pub/Sub topics and Cloud Run services.
- Retry Policy and Push Configuration ensure reliable delivery and handling of messages to Cloud Run services.
2. Sequence
3. Component
Topic Module
- Dynamically creates unique topics for messaging and event-driven communication, ensuring consistent naming and avoiding conflicts.
- Configures metadata or tags for resource identification, governance, and lifecycle management.
- Supports subscribing various endpoints (e.g., functions, services, queues) to the topic, enabling scalable publish-subscribe patterns.
- Automates the assignment of permissions to ensure secure publishing and subscription handling, following the principle of least privilege.
- Provides configurable retry policies and message delivery options to ensure reliable and fault-tolerant communication between services.
- Abstracts the underlying cloud messaging infrastructure, offering a unified interface for event-driven architectures across different providers.
- Optionally integrates with workflows or scheduling systems for advanced scenarios like delayed notifications or batched processing.
4. Code
Developers write application code that imports and declares the Topic resource from the SDK, and implements the application logic to publish and subscribe to topics.
SDK Reference by language -
Operations will use or extend the Nitric Terraform reference modules:
Last updated on Feb 4, 2025