Skip to main content

AsyncChannel

Struct AsyncChannel 

Source
pub struct AsyncChannel {
    pub channel: Channel,
    pub connection: Arc<Mutex<Connection>>,
    pub aux_channel: Option<Channel>,
    pub aux_queue_name: String,
    pub rpc_futures: Arc<DashMap<String, Sender<Vec<u8>>>>,
    pub rpc_consumer_started: Arc<AtomicBool>,
    pub shutdown_notify: Arc<Notify>,
    /* private fields */
}

Fields§

§channel: Channel§connection: Arc<Mutex<Connection>>§aux_channel: Option<Channel>§aux_queue_name: String§rpc_futures: Arc<DashMap<String, Sender<Vec<u8>>>>§rpc_consumer_started: Arc<AtomicBool>§shutdown_notify: Arc<Notify>

Implementations§

Source§

impl AsyncChannel

Source

pub fn new( channel: Channel, connection: Arc<Mutex<Connection>>, channel_tx: UnboundedSender<ChannelCmd>, rpc_futures: Arc<DashMap<String, Sender<Vec<u8>>>>, publisher_confirms: Confirmations, auto_ack: bool, pre_fetch_count: Option<u16>, aux_queue_name: Option<String>, ) -> Self

Source

pub async fn reopen(&mut self, channel_id: u16) -> Result<(), AppError>

Source

pub async fn add_subscribe( &self, queue_name: &str, routing_key: &str, handler: InternalSubscribeHandler, )

Source

pub async fn add_rpc_subscribe( &self, queue_name: &str, routing_key: &str, handler: InternalRPCHandler, )

Source

pub async fn queue_bind( &self, queue_name: &str, exchange_name: &str, routing_key: &str, ) -> Result<(), AppError>

Source

pub async fn set_qos(&self, prefetch_count: u16) -> Result<(), AppError>

Source

pub async fn setup_exchange( &self, exchange_name: &str, exchange_type: &str, durable: bool, ) -> Result<(), AppError>

Source

pub async fn publish( &self, exchange_name: &str, routing_key: &str, body: impl Into<Vec<u8>>, content_type: &str, content_encoding: ContentEncoding, delivery_mode: DeliveryMode, expiration: Option<u32>, ) -> Result<(), AppError>

Source

pub async fn queue_declare( &self, queue_name: &str, queue_options: &QueueOptions, ) -> Result<(), AppError>

Source

pub async fn close(&self) -> Result<(), AppError>

Source

pub async fn subscribe( &self, handler: Handler, routing_key: &str, exchange_name: &str, exchange_type: &str, queue_name: &str, process_timeout: Option<Duration>, queue_options: &QueueOptions, ) -> Result<(), AppError>

Source

pub async fn unsubscribe(&self, consumer_tag: &str) -> Result<(), AppError>

Source

pub async fn rpc_server( &mut self, handler: RPCHandler, routing_key: &str, exchange_name: &str, exchange_type: &str, queue_name: &str, response_timeout: Option<Duration>, queue_options: &QueueOptions, ) -> Result<(), AppError>

Source

pub async fn start_rpc_consumer(&mut self) -> Result<(), AppError>

Source

pub async fn rpc_client( &mut self, exchange_name: &str, routing_key: &str, body: impl Into<Vec<u8>>, content_type: &str, content_encoding: ContentEncoding, timeout_millis: u32, delivery_mode: DeliveryMode, expiration: Option<u32>, response: Sender<Result<Vec<u8>, AppError>>, clean_message: UnboundedSender<ChannelCmd>, message_id: Option<u64>, ) -> Result<(), AppError>

Source

pub async fn dispose(&self)

Trait Implementations§

Source§

impl Clone for AsyncChannel

Source§

fn clone(&self) -> AsyncChannel

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more