Struct lapin_futures::channel::Channel
source · pub struct Channel<T> {
pub transport: Arc<Mutex<AMQPTransport<T>>>,
pub id: u16,
}
Expand description
Channel
provides methods to act on a channel, such as managing queues
Fields
transport: Arc<Mutex<AMQPTransport<T>>>
id: u16
Implementations
sourceimpl<T: AsyncRead + AsyncWrite + Send + Sync + 'static> Channel<T>
impl<T: AsyncRead + AsyncWrite + Send + Sync + 'static> Channel<T>
sourcepub fn create(
transport: Arc<Mutex<AMQPTransport<T>>>
) -> impl Future<Item = Self, Error = Error> + Send + 'static
pub fn create(
transport: Arc<Mutex<AMQPTransport<T>>>
) -> impl Future<Item = Self, Error = Error> + Send + 'static
create a channel
sourcepub fn access_request(
&self,
realm: &str,
options: AccessRequestOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn access_request(
&self,
realm: &str,
options: AccessRequestOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
request access
returns a future that resolves once the access is granted
sourcepub fn exchange_declare(
&self,
name: &str,
exchange_type: &str,
options: ExchangeDeclareOptions,
arguments: FieldTable
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn exchange_declare(
&self,
name: &str,
exchange_type: &str,
options: ExchangeDeclareOptions,
arguments: FieldTable
) -> impl Future<Item = (), Error = Error> + Send + 'static
declares an exchange
returns a future that resolves once the exchange is available
sourcepub fn exchange_delete(
&self,
name: &str,
options: ExchangeDeleteOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn exchange_delete(
&self,
name: &str,
options: ExchangeDeleteOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
deletes an exchange
returns a future that resolves once the exchange is deleted
sourcepub fn exchange_bind(
&self,
destination: &str,
source: &str,
routing_key: &str,
options: ExchangeBindOptions,
arguments: FieldTable
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn exchange_bind(
&self,
destination: &str,
source: &str,
routing_key: &str,
options: ExchangeBindOptions,
arguments: FieldTable
) -> impl Future<Item = (), Error = Error> + Send + 'static
binds an exchange to another exchange
returns a future that resolves once the exchanges are bound
sourcepub fn exchange_unbind(
&self,
destination: &str,
source: &str,
routing_key: &str,
options: ExchangeUnbindOptions,
arguments: FieldTable
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn exchange_unbind(
&self,
destination: &str,
source: &str,
routing_key: &str,
options: ExchangeUnbindOptions,
arguments: FieldTable
) -> impl Future<Item = (), Error = Error> + Send + 'static
unbinds an exchange from another one
returns a future that resolves once the exchanges are unbound
sourcepub fn queue_declare(
&self,
name: &str,
options: QueueDeclareOptions,
arguments: FieldTable
) -> impl Future<Item = Queue, Error = Error> + Send + 'static
pub fn queue_declare(
&self,
name: &str,
options: QueueDeclareOptions,
arguments: FieldTable
) -> impl Future<Item = Queue, Error = Error> + Send + 'static
declares a queue
returns a future that resolves once the queue is available
the mandatory
and ìmmediate
options can be set to true,
but the return message will not be handled
sourcepub fn queue_bind(
&self,
name: &str,
exchange: &str,
routing_key: &str,
options: QueueBindOptions,
arguments: FieldTable
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn queue_bind(
&self,
name: &str,
exchange: &str,
routing_key: &str,
options: QueueBindOptions,
arguments: FieldTable
) -> impl Future<Item = (), Error = Error> + Send + 'static
binds a queue to an exchange
returns a future that resolves once the queue is bound to the exchange
sourcepub fn queue_unbind(
&self,
name: &str,
exchange: &str,
routing_key: &str,
options: QueueUnbindOptions,
arguments: FieldTable
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn queue_unbind(
&self,
name: &str,
exchange: &str,
routing_key: &str,
options: QueueUnbindOptions,
arguments: FieldTable
) -> impl Future<Item = (), Error = Error> + Send + 'static
unbinds a queue from the exchange
returns a future that resolves once the queue is unbound from the exchange
sourcepub fn confirm_select(
&self,
options: ConfirmSelectOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn confirm_select(
&self,
options: ConfirmSelectOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
sets up confirm extension for this channel
sourcepub fn basic_qos(
&self,
options: BasicQosOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn basic_qos(
&self,
options: BasicQosOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
specifies quality of service for a channel
sourcepub fn basic_publish(
&self,
exchange: &str,
routing_key: &str,
payload: Vec<u8>,
options: BasicPublishOptions,
properties: BasicProperties
) -> impl Future<Item = Option<RequestId>, Error = Error> + Send + 'static
pub fn basic_publish(
&self,
exchange: &str,
routing_key: &str,
payload: Vec<u8>,
options: BasicPublishOptions,
properties: BasicProperties
) -> impl Future<Item = Option<RequestId>, Error = Error> + Send + 'static
publishes a message on a queue
the future’s result is:
Some(request_id)
if we’re on a confirm channel and the message was ack’dNone
if we’re not on a confirm channel or the message was nack’d
sourcepub fn basic_consume(
&self,
queue: &Queue,
consumer_tag: &str,
options: BasicConsumeOptions,
arguments: FieldTable
) -> impl Future<Item = Consumer<T>, Error = Error> + Send + 'static
pub fn basic_consume(
&self,
queue: &Queue,
consumer_tag: &str,
options: BasicConsumeOptions,
arguments: FieldTable
) -> impl Future<Item = Consumer<T>, Error = Error> + Send + 'static
creates a consumer stream
returns a future of a Consumer
that resolves once the method succeeds
Consumer
implements futures::Stream
, so it can be used with any of
the usual combinators
sourcepub fn basic_ack(
&self,
delivery_tag: u64,
multiple: bool
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn basic_ack(
&self,
delivery_tag: u64,
multiple: bool
) -> impl Future<Item = (), Error = Error> + Send + 'static
acks a message
sourcepub fn basic_nack(
&self,
delivery_tag: u64,
multiple: bool,
requeue: bool
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn basic_nack(
&self,
delivery_tag: u64,
multiple: bool,
requeue: bool
) -> impl Future<Item = (), Error = Error> + Send + 'static
nacks a message
sourcepub fn basic_reject(
&self,
delivery_tag: u64,
requeue: bool
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn basic_reject(
&self,
delivery_tag: u64,
requeue: bool
) -> impl Future<Item = (), Error = Error> + Send + 'static
rejects a message
sourcepub fn basic_get(
&self,
queue: &str,
options: BasicGetOptions
) -> impl Future<Item = BasicGetMessage, Error = Error> + Send + 'static
pub fn basic_get(
&self,
queue: &str,
options: BasicGetOptions
) -> impl Future<Item = BasicGetMessage, Error = Error> + Send + 'static
gets a message
sourcepub fn queue_purge(
&self,
queue_name: &str,
options: QueuePurgeOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn queue_purge(
&self,
queue_name: &str,
options: QueuePurgeOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
Purge a queue.
This method removes all messages from a queue which are not awaiting acknowledgment.
sourcepub fn queue_delete(
&self,
queue_name: &str,
options: QueueDeleteOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn queue_delete(
&self,
queue_name: &str,
options: QueueDeleteOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
Delete a queue.
This method deletes a queue. When a queue is deleted any pending messages are sent to a dead-letter queue if this is defined in the server configuration, and all consumers on the queue are cancelled.
If if_unused
is set, the server will only delete the queue if it has no consumers.
If the queue has consumers the server does not delete it but raises a channel exception instead.
If if_empty
is set, the server will only delete the queue if it has no messages.
sourcepub fn close(
&self,
code: u16,
message: &str
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn close(
&self,
code: u16,
message: &str
) -> impl Future<Item = (), Error = Error> + Send + 'static
closes the channel
sourcepub fn close_ok(&self) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn close_ok(&self) -> impl Future<Item = (), Error = Error> + Send + 'static
ack a channel close
sourcepub fn channel_flow(
&self,
options: ChannelFlowOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn channel_flow(
&self,
options: ChannelFlowOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
update a channel flow
sourcepub fn channel_flow_ok(
&self,
options: ChannelFlowOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
pub fn channel_flow_ok(
&self,
options: ChannelFlowOptions
) -> impl Future<Item = (), Error = Error> + Send + 'static
ack an update to a channel flow