pub struct AMQPQueueHandle { /* private fields */ }Expand description
A handle to an AMQP queue.
Trait Implementations§
Source§impl Clone for AMQPQueueHandle
impl Clone for AMQPQueueHandle
Source§fn clone(&self) -> AMQPQueueHandle
fn clone(&self) -> AMQPQueueHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl QueueHandle for AMQPQueueHandle
impl QueueHandle for AMQPQueueHandle
Source§fn declare_consumer<'life0, 'life1, 'async_trait, PayloadTarget>(
&'life0 self,
consumer_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Self::Consumer<PayloadTarget>>> + Send + 'async_trait>>where
PayloadTarget: 'async_trait + Serializable,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn declare_consumer<'life0, 'life1, 'async_trait, PayloadTarget>(
&'life0 self,
consumer_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Self::Consumer<PayloadTarget>>> + Send + 'async_trait>>where
PayloadTarget: 'async_trait + Serializable,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a consumer instance to the queue.
use paladin::{
queue::{
Connection,
QueueHandle,
QueueOptions,
amqp::{AMQPConnection, AMQPConnectionOptions}
}
};
use serde::{Serialize, Deserialize};
use anyhow::Result;
#[derive(Serialize, Deserialize)]
struct MyStruct {
field: String,
}
#[tokio::main]
async fn main() -> Result<()> {
let conn = AMQPConnection::new(AMQPConnectionOptions {
uri: "amqp://localhost:5672",
qos: Some(1),
serializer: Default::default(),
}).await?;
let queue = conn.declare_queue("my_queue", QueueOptions::default()).await?;
let consumer = queue.declare_consumer::<MyStruct>("my_consumer").await?;
Ok(())
}type Acker = AMQPAcker
type Consumer<PayloadTarget: Serializable> = AMQPConsumer<PayloadTarget>
type Publisher<PayloadTarget: Serializable> = AMQPPublisher<PayloadTarget>
fn publisher<PayloadTarget: Serializable>( &self, ) -> Self::Publisher<PayloadTarget>
fn publish<'life0, 'life1, 'async_trait, PayloadTarget>(
&'life0 self,
payload: &'life1 PayloadTarget,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self::Publisher<PayloadTarget>: Send,
PayloadTarget: 'async_trait + Serializable,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for AMQPQueueHandle
impl !RefUnwindSafe for AMQPQueueHandle
impl Send for AMQPQueueHandle
impl Sync for AMQPQueueHandle
impl Unpin for AMQPQueueHandle
impl !UnwindSafe for AMQPQueueHandle
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more