pub struct Client<T> {
    pub configuration: ConnectionConfiguration,
    /* private fields */
}
Expand description

the Client structures connects to a server and creates channels

Fields

configuration: ConnectionConfiguration

Implementations

Takes a stream (TCP, TLS, unix socket, etc) and uses it to connect to an AMQP server.

This function returns a future that resolves once the connection handshake is done. The result is a tuple containing a Client that can be used to create Channels and a Heartbeat instance. The heartbeat is a task (it implements Future) that should be spawned independently of the other futures.

To stop the heartbeat task, see HeartbeatHandle.

Example
use failure::Error;
use lapin_futures::client::{Client, ConnectionOptions};
use tokio::net::TcpStream;
use tokio::runtime::Runtime;

let addr = "127.0.0.1:5672".parse().unwrap();
let f = TcpStream::connect(&addr)
    .map_err(Error::from)
    .and_then(|stream| {
        Client::connect(stream, ConnectionOptions::default())
            .map_err(Error::from)
    })
    .and_then(|(client, mut heartbeat)| {
        let handle = heartbeat.handle().unwrap();
        tokio::spawn(
            heartbeat.map_err(|e| eprintln!("The heartbeat task errored: {}", e))
        );

        /// ...

        handle.stop();
        Ok(())
    });
Runtime::new().unwrap().block_on_all(
    f.map_err(|e| eprintln!("An error occured: {}", e))
).expect("runtime exited with failure");

creates a new channel

returns a future that resolves to a Channel once the method succeeds

returns a future that resolves to a Channel once the method succeeds the channel will support RabbitMQ’s confirm extension

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.