pub trait QueueSource: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn pull<'life0, 'async_trait>(
&'life0 self,
max_messages: usize,
wait: Duration,
) -> Pin<Box<dyn Future<Output = Result<Vec<QueueMessage>, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
receipt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn nack<'life0, 'life1, 'async_trait>(
&'life0 self,
receipt: &'life1 str,
redeliver_after: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Expand description
Core traits and types.
Always available regardless of feature flags. Includes:
Agent- The fundamental trait for all agentsTool/Toolset- For extending agents with capabilitiesSession/State- For managing conversation contextEvent- For streaming agent responsesAdkError/Result- Unified error handling A pull-based, at-least-once message source.
Every implementation passes adk_core::queue_source_conformance_tests! (feature
conformance).
Required Methods§
Sourcefn pull<'life0, 'async_trait>(
&'life0 self,
max_messages: usize,
wait: Duration,
) -> Pin<Box<dyn Future<Output = Result<Vec<QueueMessage>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn pull<'life0, 'async_trait>(
&'life0 self,
max_messages: usize,
wait: Duration,
) -> Pin<Box<dyn Future<Output = Result<Vec<QueueMessage>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Leases up to max_messages messages, waiting up to wait for the first one.
A leased message is not returned again until it is nacked or its lease lapses.
§Errors
Returns an error when the broker cannot be reached.
Sourcefn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
receipt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
receipt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Removes the message leased under receipt.
§Errors
Returns QUEUE_UNKNOWN_RECEIPT_CODE when the lease lapsed or the receipt is unknown;
the message will be redelivered.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".