尧图网站建设 尧图网络
  • 首页
  • 关于我们
  • 服务项目
  • 案例展示
  • 建站流程
  • 资讯中心
  • 联系我们
首页/资讯中心/详情

编译zenoh-python 支持python 包直接加载plugin插件

编译zenoh-python 支持python 包直接加载plugin插件
📅 发布时间:2026/6/20 2:31:54

编译zenoh-python 支持python 包直接加载plugin插件

了解zenoh的都应该支持zenoh 包含了几种角色,peer,client,router,这些都是在配置指定的,但是在一些语言sdk 中,zenoh 为了简单,一些模式尽管可以配置,但是实际参数是不能生效的,比如router 模式的plugin 加载

解决方法

可以参考zenohd 的方法(核心部分是plugins feature),使用上是一样的

参考构建

  • Cargo.toml
[features]
default = ["zenoh/default", "zenoh-ext","zenoh/internal_config","zenoh/plugins","zenoh/runtime_plugins"]
  • 构建
 maturin build
  • 使用

简单示例,核心是先得安装构建的pip whl 包

config3.json5 配置

{"mode": "router","listen": {"endpoints": ["tcp/0.0.0.0:7447"]},"plugins_loading": {"enabled": true,"search_dirs": ["./libs"]},"plugins": {"mqtt": {"port": 1883},"webserver": {"http_port": 8080},// configuration of "storage-manager" plugin:"storage_manager": {"volumes": {// configuration of a "fs" volume (the "zenoh_backend_fs" backend library will be loaded at startup)"fs": {}},"storages": {// configuration of a "demo" storage using the "fs" volume"demo": {// the key expression this storage will subscribes to"key_expr": "demo/example/**",// this prefix will be stripped from the received key when converting to file path// this argument is optional."strip_prefix": "demo/example","volume": {"id": "fs",// the key/values will be stored as files within this directory (relative to ${ZENOH_BACKEND_FS_ROOT})"dir": "example"},"replication": {// This field was named publication_interval."interval": 10,// This field was named delta."sub_intervals": 5,"propagation_delay": 250,// These fields did not exist before."hot": 6,"warm": 30}},"demov2": {// the key expression this storage will subscribes to"key_expr": "video/capture/**",// this prefix will be stripped from the received key when converting to file path// this argument is optional."strip_prefix": "video","volume": {"id": "fs",// the key/values will be stored as files within this directory (relative to ${ZENOH_BACKEND_FS_ROOT})"dir": "examplev2"},"replication": {// This field was named publication_interval."interval": 10,// This field was named delta."sub_intervals": 5,"propagation_delay": 250,// These fields did not exist before."hot": 6,"warm": 30}}}},// Optionally, add the REST plugin"rest": {"http_port": 8001},"remote_api": {"websocket_port": 10000}},"adminspace": {"permissions": {"read": true,"write": true}}
}
import zenoh
print("Opening session...") 
with zenoh.open(zenoh.Config.from_file("config3.json5")) as session:print("Declaring Queryable on 'demo/sensors/appv3'...")with session.liveliness().declare_token("demo/sensors/appv3") as token:print("Press CTRL-C to quit...")while True:pass

一些细节问题

注意zenoh插件以及zenoh 版本的对应,还有就是rust 版本,这个很重要,否则会有插件不能生效的问题,甚至服务出现segmentation fault,具体版本的下载可以通过release 部分

说明

rust 开发的服务启动参考如下,实际上就是zenoh::open

fn main() {if let Err(e) = init_logging() {eprintln!("{e}. Exiting...");std::process::exit(-1);}tracing::info!("zenohd {}", *LONG_VERSION);let args = Args::parse();let config = config_from_args(&args);tracing::info!("Initial conf: {}", &config);let _session = match zenoh::open(config).wait() {Ok(runtime) => runtime,Err(e) => {eprintln!("{e}. Exiting...");std::process::exit(-1);}};std::thread::park();
}

参考资料

https://github.com/eclipse-zenoh/zenoh/tree/main/zenohd

https://github.com/eclipse-zenoh/zenoh-python

相关新闻

  • ArtCafeAI-Agent-Framework 基于nats 消息的模块化agent 协作框架
  • 2025年比较好的成都全品类五金,极简全品类五金厂家推荐及选择建议:直销制造
  • 2025年比较好的职业装定制,高端职业装定制设计厂家推荐及选择建议:直销制造

最新新闻

  • 2026西安2026正规漏水检测维修公司精选口碑榜TOP5权威推荐-精准定位检测漏水点-专业防水补漏堵漏维修、卫生间/厨房/屋顶/天沟/地下室/阳台防水漏水检测维修 - 安佳防水
  • 微信聊天记录永久保存终极指南:如何让珍贵对话永不丢失
  • MC9S12XE GPIO深度解析:从寄存器配置到中断实战
  • 2026襄阳2026正规漏水检测维修公司精选口碑榜TOP5权威推荐-精准定位检测漏水点-专业防水补漏堵漏维修、卫生间/厨房/屋顶/天沟/地下室/阳台防水漏水检测维修 - 安佳防水
  • 5步掌握FitGirl游戏启动器:高效管理压缩游戏的终极工具
  • 2026年西安评价高的玻璃门生产厂家哪家强 - 品牌鉴赏官2026

日新闻

  • 信任的进化:技术实现详解——如何用JavaScript构建博弈论模拟器
  • Terrakube自定义工作流:如何集成OPA、Infracost等工具扩展IaC能力
  • grunt-concurrent快速入门:5分钟学会并行运行Grunt任务

周新闻

  • 3步解锁iOS设备:applera1n激活锁绕过完全指南
  • 39 2026 人工智能证书终极盘点,普通人选 AI 证书可以从这些方向入手
  • Redis 暴露公网有多危险?从端口检查到补救步骤

月新闻

  • 【总结】入门篇:50句话让你记住架构核心概念
  • WeChatMsg技术方案解析:实现Mac微信数据自主管理的完整解决方案
  • WeChatMsg:革新性微信数据备份方案,打造你的专属数字记忆库

关于尧图

  • 公司简介
  • 团队介绍
  • 企业文化
  • 荣誉资质

服务项目

  • 定制开发
  • 电商建站
  • UI 设计
  • 运维服务

快速链接

  • 案例展示
  • 建站流程
  • 常见问题
  • 资讯中心

联系方式

  • 📍北京市朝阳区互联网产业园 A 座 10 层
  • 📞400-888-8888
  • ✉️contact@rkmt.cn
  • 🕐周一至周日 9:00-21:00

© 2024 北京尧图网络科技有限公司 版权所有 | 京 ICP 备 XXXXXXXX 号