diff --git a/Cargo.lock b/Cargo.lock index f38c645..9e30558 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,23 +31,23 @@ dependencies = [ [[package]] name = "amq-protocol" -version = "6.0.0-rc3" +version = "6.0.0-rc7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "amq-protocol-codegen 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)", - "amq-protocol-tcp 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)", - "amq-protocol-types 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)", - "amq-protocol-uri 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)", + "amq-protocol-codegen 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)", + "amq-protocol-tcp 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)", + "amq-protocol-types 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)", + "amq-protocol-uri 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)", "cookie-factory 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "nom 6.0.0-alpha1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "amq-protocol-codegen" -version = "6.0.0-rc3" +version = "6.0.0-rc7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "amq-protocol-types 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)", + "amq-protocol-types 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)", "handlebars 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", @@ -55,17 +55,17 @@ dependencies = [ [[package]] name = "amq-protocol-tcp" -version = "6.0.0-rc3" +version = "6.0.0-rc7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "amq-protocol-uri 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)", + "amq-protocol-uri 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tcp-stream 0.15.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tcp-stream 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "amq-protocol-types" -version = "6.0.0-rc3" +version = "6.0.0-rc7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cookie-factory 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -76,7 +76,7 @@ dependencies = [ [[package]] name = "amq-protocol-uri" -version = "6.0.0-rc3" +version = "6.0.0-rc7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -201,6 +201,11 @@ dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bit-vec" version = "0.4.4" @@ -611,11 +616,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lapin" -version = "1.0.0-beta4" +version = "1.0.0-rc6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "amq-protocol 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)", - "amq-protocol-codegen 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)", + "amq-protocol 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)", + "amq-protocol-codegen 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)", "async-task 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -914,7 +919,7 @@ dependencies = [ "hubcaps 0.3.16 (git+https://github.com/grahamc/hubcaps.git)", "hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lapin 1.0.0-beta4 (registry+https://github.com/rust-lang/crates.io-index)", + "lapin 1.0.0-rc6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1011,6 +1016,16 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "pem" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "percent-encoding" version = "1.0.1" @@ -1392,12 +1407,13 @@ dependencies = [ [[package]] name = "tcp-stream" -version = "0.15.4" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pem 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1675,11 +1691,11 @@ dependencies = [ "checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" "checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" "checksum amq-proto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "66d79639b71f74c7006c12683cc2ff221615a51a741688fa7798ccd080dc54d3" -"checksum amq-protocol 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)" = "fc2af3b0b15738172334d196a3b98e651fcdbbcecf2069138f5bbedf400a3d6d" -"checksum amq-protocol-codegen 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)" = "c3f2c370a138e85cec1656cb741de76ca80cf25c9a63f5bf611a7af6152315f2" -"checksum amq-protocol-tcp 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)" = "bc78407975f9b9cb73d01abf84996a54a64058493c147ba6c2bd3149df0937f7" -"checksum amq-protocol-types 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)" = "4425e82ba6069abf1132abae0395dd2d59bc0f5bd25b4001208dbfa7701f135f" -"checksum amq-protocol-uri 6.0.0-rc3 (registry+https://github.com/rust-lang/crates.io-index)" = "9551b95be48c02825f0944eb45b372112e2ac4f76e1ab684c8bc789e62d8a7e4" +"checksum amq-protocol 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)" = "f107cf5f6960ae3ddf1c5b5dea85a68a4f6d70c51ae66b8df86180860145da1b" +"checksum amq-protocol-codegen 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)" = "1f51a7891d6185faa895186b2a604ce9618088626bb2097f09fcb28bfc102636" +"checksum amq-protocol-tcp 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)" = "b60861763928b4776f3b129595a13caf9caa533e89ed98436613c49d5041d887" +"checksum amq-protocol-types 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)" = "00e2c0836916200c43f462f35dea50b520a551c4d755e07492e389b19befba95" +"checksum amq-protocol-uri 6.0.0-rc7 (registry+https://github.com/rust-lang/crates.io-index)" = "7b891342708e4ed231278ef5bb8ccccf6ca1542fc56d02e7a1cff548ac2ad215" "checksum amqp 0.1.0 (git+https://github.com/grahamc/rust-amqp.git)" = "" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" @@ -1692,6 +1708,7 @@ dependencies = [ "checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "621fc7ecb8008f86d7fb9b95356cd692ce9514b80a86d85b397f32a22da7b9e2" +"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" "checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" @@ -1745,7 +1762,7 @@ dependencies = [ "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c54d9f465d530a752e6ebdc217e081a7a614b48cb200f6f0aee21ba6bc9aabb" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" -"checksum lapin 1.0.0-beta4 (registry+https://github.com/rust-lang/crates.io-index)" = "daceedfb02915683f986b8860f3ed65530e8a33fcc77b3a0f52dffeb08e482c3" +"checksum lapin 1.0.0-rc6 (registry+https://github.com/rust-lang/crates.io-index)" = "6fcc19a0b0a5c9de7fd25ec93a590ab0c12780729fb72cf68ecb8fc08b1005e3" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum lexical-core 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "db65c6da02e61f55dae90a0ae427b2a5f6b3e8db09f58d10efab23af92592616" @@ -1787,6 +1804,7 @@ dependencies = [ "checksum openssl-sys 0.9.55 (registry+https://github.com/rust-lang/crates.io-index)" = "7717097d810a0f2e2323f9e5d11e71608355e24828410b55b9d4f18aa5f9a5d8" "checksum parking_lot 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" "checksum parking_lot_core 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +"checksum pem 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a1581760c757a756a41f0ee3ff01256227bdf64cb752839779b95ffb01c59793" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum pest 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" @@ -1835,7 +1853,7 @@ dependencies = [ "checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" "checksum syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "410a7488c0a728c7ceb4ad59b9567eb4053d02e8cc7f5c0e0eeeb39518369213" "checksum sys-info 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "617f594d3869801871433390254b4a79f2a18176d7f4ad5784fa990bc8c12986" -"checksum tcp-stream 0.15.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cffaa277f6a7eae762f9ba79da149e239e1940b392d6dd32c1cd3bb27ca6d9dd" +"checksum tcp-stream 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3bf936a66fc83b53e50a754b2dc3ca607c1149710b5e96f0546e053a9764303e" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11ce2fe9db64b842314052e2421ac61a73ce41b898dc8e3750398b219c5fc1e0" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" diff --git a/ofborg/Cargo.toml b/ofborg/Cargo.toml index c365352..63f8e54 100644 --- a/ofborg/Cargo.toml +++ b/ofborg/Cargo.toml @@ -29,4 +29,4 @@ chrono = "0.4.6" separator = "0.4.1" async-std = "1.5.0" -lapin = "1.0.0-beta4" +lapin = "1.0.0-rc6" diff --git a/ofborg/src/easylapin.rs b/ofborg/src/easylapin.rs index 195b975..c74ce6a 100644 --- a/ofborg/src/easylapin.rs +++ b/ofborg/src/easylapin.rs @@ -18,12 +18,10 @@ use lapin::options::{ ExchangeDeclareOptions, QueueBindOptions, QueueDeclareOptions, }; use lapin::types::{AMQPValue, FieldTable}; -use lapin::{ - BasicProperties, Channel, CloseOnDrop, Connection, ConnectionProperties, ExchangeKind, -}; +use lapin::{BasicProperties, Channel, Connection, ConnectionProperties, ExchangeKind}; use tracing::{debug, trace}; -pub fn from_config(cfg: &RabbitMQConfig) -> Result, lapin::Error> { +pub fn from_config(cfg: &RabbitMQConfig) -> Result { let mut props = FieldTable::default(); props.insert( "ofborg_version".into(), @@ -34,7 +32,7 @@ pub fn from_config(cfg: &RabbitMQConfig) -> Result, lapi task::block_on(Connection::connect(&cfg.as_uri(), opts)) } -impl ChannelExt for CloseOnDrop { +impl ChannelExt for Channel { type Error = lapin::Error; fn declare_exchange(&mut self, config: ExchangeConfig) -> Result<(), Self::Error> { @@ -81,7 +79,7 @@ impl ChannelExt for CloseOnDrop { } } -impl<'a, W: SimpleWorker + 'a> ConsumerExt<'a, W> for CloseOnDrop { +impl<'a, W: SimpleWorker + 'a> ConsumerExt<'a, W> for Channel { type Error = lapin::Error; type Handle = Pin + 'a>>; @@ -117,7 +115,7 @@ impl<'a, W: SimpleWorker + 'a> ConsumerExt<'a, W> for CloseOnDrop { /// Same as a regular channel, but without prefetching, /// used for services with multiple instances. -pub struct WorkerChannel(pub CloseOnDrop); +pub struct WorkerChannel(pub Channel); impl<'a, W: SimpleWorker + 'a> ConsumerExt<'a, W> for WorkerChannel { type Error = lapin::Error; @@ -130,12 +128,12 @@ impl<'a, W: SimpleWorker + 'a> ConsumerExt<'a, W> for WorkerChannel { } pub struct ChannelNotificationReceiver<'a> { - channel: &'a mut CloseOnDrop, + channel: &'a mut lapin::Channel, deliver: &'a Delivery, } impl<'a> ChannelNotificationReceiver<'a> { - pub fn new(channel: &'a mut CloseOnDrop, deliver: &'a Delivery) -> Self { + pub fn new(channel: &'a mut lapin::Channel, deliver: &'a Delivery) -> Self { ChannelNotificationReceiver { channel, deliver } } } @@ -149,7 +147,7 @@ impl<'a> NotificationReceiver for ChannelNotificationReceiver<'a> { // FIXME the consumer trait for SimpleWorker and SimpleNotifyWorker conflict, // but one could probably be implemented in terms of the other instead. -pub struct NotifyChannel(pub CloseOnDrop); +pub struct NotifyChannel(pub Channel); impl<'a, W: SimpleNotifyWorker + 'a> ConsumerExt<'a, W> for NotifyChannel { type Error = lapin::Error; @@ -190,7 +188,7 @@ impl<'a, W: SimpleNotifyWorker + 'a> ConsumerExt<'a, W> for NotifyChannel { } async fn action_deliver( - chan: &CloseOnDrop, + chan: &Channel, deliver: &Delivery, action: Action, ) -> Result<(), lapin::Error> { diff --git a/ofborg/src/stats.rs b/ofborg/src/stats.rs index 97bccef..18ce660 100644 --- a/ofborg/src/stats.rs +++ b/ofborg/src/stats.rs @@ -2,7 +2,6 @@ use amqp::protocol::basic; use amqp::Basic; use async_std::task; use lapin::options::BasicPublishOptions; -use lapin::CloseOnDrop; include!(concat!(env!("OUT_DIR"), "/events.rs")); @@ -59,8 +58,8 @@ impl SysEvents for RabbitMQ { } } -impl RabbitMQ> { - pub fn from_lapin(identity: &str, channel: CloseOnDrop) -> Self { +impl RabbitMQ { + pub fn from_lapin(identity: &str, channel: lapin::Channel) -> Self { RabbitMQ { identity: identity.to_owned(), channel, @@ -68,7 +67,7 @@ impl RabbitMQ> { } } -impl SysEvents for RabbitMQ> { +impl SysEvents for RabbitMQ { fn notify(&mut self, event: Event) { let props = lapin::BasicProperties::default().with_content_type("application/json".into()); task::block_on(async {