Fixup connection issues
This commit is contained in:
parent
b47704d6e4
commit
836028cf16
1 changed files with 12 additions and 3 deletions
|
@ -161,20 +161,29 @@ pub fn session_from_config(config: &RabbitMQConfig) -> Result<amqp::Session, amq
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut properties = amqp::Table::new();
|
let mut properties = amqp::Table::new();
|
||||||
// properties.insert("identity".to_owned(), amqp::TableEntry::LongString(identity.to_owned()));
|
|
||||||
properties.insert(
|
properties.insert(
|
||||||
"ofborg_version".to_owned(),
|
"ofborg_version".to_owned(),
|
||||||
amqp::TableEntry::LongString(ofborg::VERSION.to_owned()),
|
amqp::TableEntry::LongString(ofborg::VERSION.to_owned()),
|
||||||
);
|
);
|
||||||
|
|
||||||
amqp::Session::new(amqp::Options {
|
let options = amqp::Options {
|
||||||
host: config.host.clone(),
|
host: config.host.clone(),
|
||||||
|
port: match scheme {
|
||||||
|
amqp::AMQPScheme::AMQPS => 5671,
|
||||||
|
amqp::AMQPScheme::AMQP => 5672,
|
||||||
|
},
|
||||||
|
vhost: "/".to_owned(),
|
||||||
login: config.username.clone(),
|
login: config.username.clone(),
|
||||||
password: config.password.clone(),
|
password: config.password.clone(),
|
||||||
scheme: scheme,
|
scheme: scheme,
|
||||||
properties: properties,
|
properties: properties,
|
||||||
..amqp::Options::default()
|
..amqp::Options::default()
|
||||||
})
|
};
|
||||||
|
|
||||||
|
let session = try!(amqp::Session::new(options));
|
||||||
|
|
||||||
|
info!("Connected to {}", &config.host);
|
||||||
|
return Ok(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait TypedWrappers {
|
pub trait TypedWrappers {
|
||||||
|
|
Loading…
Reference in a new issue