From 737871ea841dcf20eba58c52fcfacbf3bcc10dfe Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Wed, 29 Apr 2020 21:37:01 +0200 Subject: [PATCH] implement ofborg version property for lapin --- ofborg/src/easylapin.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ofborg/src/easylapin.rs b/ofborg/src/easylapin.rs index 915741a..11c4a66 100644 --- a/ofborg/src/easylapin.rs +++ b/ofborg/src/easylapin.rs @@ -3,19 +3,25 @@ use std::pin::Pin; use crate::config::RabbitMQConfig; use crate::easyamqp::*; use crate::notifyworker::{NotificationReceiver, SimpleNotifyWorker}; +use crate::ofborg; use crate::worker::{Action, SimpleWorker}; use async_std::future::Future; use async_std::stream::StreamExt; use async_std::task; use lapin::{ - message::Delivery, options::*, types::FieldTable, BasicProperties, Channel, CloseOnDrop, + types::AMQPValue, message::Delivery, options::*, types::FieldTable, BasicProperties, Channel, CloseOnDrop, Connection, ConnectionProperties, ExchangeKind, }; pub fn from_config(cfg: &RabbitMQConfig) -> Result, lapin::Error> { - let opts = ConnectionProperties::default(); - // TODO version + let mut props = FieldTable::default(); + props.insert( + "ofborg_version".into(), + AMQPValue::LongString(ofborg::VERSION.into()), + ); + let mut opts = ConnectionProperties::default(); + opts.client_properties = props; task::block_on(Connection::connect(&cfg.as_uri(), opts)) }