pub struct Session { /* fields omitted */ }
Use open_url
to create new amqp session from a "amqp url"
url_string
: The format is: amqp://username:password@host:port/virtual_host
Most of the params have their default, so you can just pass this:
"amqp://localhost//"
and it will connect to rabbitmq server,
running on localhost
on port 5672
,
with login "guest"
, password: "guest"
to vhost "/"
Initialize new rabbitmq session.
You can use default options:
use std::default::Default;
use amqp::{Options, Session};
let session = match Session::new(Options { .. Default::default() }){
Ok(session) => session,
Err(error) => panic!("Failed openning an amqp session: {:?}", error)
};
open_channel
will open a new amqp channel:
channel_id
- channel number
use std::default::Default;
use amqp::{Options, Session};
let mut session = Session::new(Options { .. Default::default() }).ok().unwrap();
let channel = match session.open_channel(1){
Ok(channel) => channel,
Err(error) => panic!("Failed openning channel: {:?}", error)
};
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static