Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated to new plugin API #32

Merged
merged 6 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 53 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ $ git clone https://github.com/eclipse-zenoh/zenoh-plugin-mqtt.git
$ cd zenoh-plugin-mqtt
```

> :warning: **WARNING** :warning: : On Windows and Linux, don't use `cargo build` command without specifying a package with `-p`. Building both `zenoh-plugin-mqtt` (plugin library) and `zenoh-bridge-mqtt` (standalone executable) together will lead to a `multiple definition of `load_plugin'` error at link time. See [#19](https://github.com/eclipse-zenoh/zenoh-plugin-mqtt/issues/19#issuecomment-1754742678) for explanations.

You can then choose between building the zenoh bridge for MQTT:
milyin marked this conversation as resolved.
Show resolved Hide resolved
- as a plugin library that can be dynamically loaded by the zenoh router (`zenohd`):
```bash
Expand Down
10 changes: 7 additions & 3 deletions zenoh-bridge-mqtt/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use clap::{App, Arg};
use std::str::FromStr;
use zenoh::config::{Config, ModeDependentValue};
use zenoh::prelude::*;
use zenoh_plugin_trait::Plugin;

macro_rules! insert_json5 {
($config: expr, $args: expr, $key: expr, if $name: expr) => {
Expand All @@ -36,8 +37,8 @@ macro_rules! insert_json5 {

fn parse_args() -> Config {
let app = App::new("zenoh bridge for MQTT")
.version(zenoh_plugin_mqtt::GIT_VERSION)
.long_version(zenoh_plugin_mqtt::LONG_VERSION.as_str())
.version(zenoh_plugin_mqtt::MqttPlugin::PLUGIN_VERSION)
.long_version(zenoh_plugin_mqtt::MqttPlugin::PLUGIN_LONG_VERSION)
//
// zenoh related arguments:
//
Expand Down Expand Up @@ -168,7 +169,10 @@ r#"-w, --generalise-pub=[String]... 'A list of key expression to use for gener
#[async_std::main]
async fn main() {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("z=info")).init();
log::info!("zenoh-bridge-mqtt {}", *zenoh_plugin_mqtt::LONG_VERSION);
log::info!(
"zenoh-bridge-mqtt {}",
zenoh_plugin_mqtt::MqttPlugin::PLUGIN_LONG_VERSION
);

let config = parse_args();
let rest_plugin = config.plugin("rest").is_some();
Expand Down
2 changes: 1 addition & 1 deletion zenoh-plugin-mqtt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ crate-type = ["cdylib", "rlib"]

[features]
default = ["no_mangle"]
no_mangle = ["zenoh-plugin-trait/no_mangle"]
no_mangle = []
stats = ["zenoh/stats"]

[dependencies]
Expand Down
Loading