Struct amqp::Session [] [src]

pub struct Session { /* fields omitted */ }

Methods

impl Session
[src]

Use open_url to create new amqp session from a "amqp url"

Arguments

  • 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:

Example

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:

Arguments

  • channel_id - channel number

Exmaple

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)
};