QueueAdapter trait defines the interface for queue implementations in the iii framework. Adapters handle message enqueueing, topic subscriptions, and dead-letter queue management.
Location
src/modules/queue/mod.rs
Trait Definition
Required Methods
enqueue
&str
required
The topic name to publish the message to
Value
required
The message payload as a JSON value
Option<String>
W3C traceparent header for distributed tracing
Option<String>
W3C baggage header for trace context propagation
subscribe
&str
required
The topic name to subscribe to
&str
required
Unique identifier for this subscription
&str
required
The ID of the function to invoke when messages arrive
Option<String>
Optional filter function ID to conditionally process messages
Option<SubscriberQueueConfig>
Optional queue configuration (retries, concurrency, timeouts, etc.)
unsubscribe
&str
required
The topic name to unsubscribe from
&str
required
The subscription ID to remove
redrive_dlq
&str
required
The topic whose dead-letter queue to redrive
anyhow::Result<u64>
The number of messages redriven, or an error
dlq_count
&str
required
The topic whose dead-letter queue to count
anyhow::Result<u64>
The message count, or an error
Implementation Example
Related Types
SubscriberQueueConfig
queue_mode- Queue type (e.g., “fifo”, “standard”)max_retries- Maximum retry attempts before moving to DLQconcurrency- Number of concurrent message processorsvisibility_timeout- Time (ms) before message becomes visible againdelay_seconds- Initial delay before processingbackoff_type- Retry backoff strategy (e.g., “exponential”)backoff_delay_ms- Base delay between retries
Registration Example
See Also
- Module - Base module trait
- StreamAdapter - Trait for stream adapters
- Queue Module - Queue module implementation