Skip to main content
The QueueAdapter trait defines the interface for queue implementations in the iii framework. Adapters handle message enqueueing, topic subscriptions, and dead-letter queue management.

Location

Defined in src/modules/queue/mod.rs

Trait Definition

Required Methods

enqueue

Enqueues a message to a topic with optional OpenTelemetry tracing context.
&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

Subscribes to a topic with a handler function and optional filtering.
&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

Removes a subscription from a topic.
&str
required
The topic name to unsubscribe from
&str
required
The subscription ID to remove

redrive_dlq

Redrives (retries) all messages from the dead-letter queue for a topic.
&str
required
The topic whose dead-letter queue to redrive
anyhow::Result<u64>
The number of messages redriven, or an error

dlq_count

Returns the number of messages in the dead-letter queue for a topic.
&str
required
The topic whose dead-letter queue to count
anyhow::Result<u64>
The message count, or an error

Implementation Example

SubscriberQueueConfig

Configuration for queue subscriber behavior:
  • queue_mode - Queue type (e.g., “fifo”, “standard”)
  • max_retries - Maximum retry attempts before moving to DLQ
  • concurrency - Number of concurrent message processors
  • visibility_timeout - Time (ms) before message becomes visible again
  • delay_seconds - Initial delay before processing
  • backoff_type - Retry backoff strategy (e.g., “exponential”)
  • backoff_delay_ms - Base delay between retries

Registration Example

See Also