Skip to content

feat(zenorb): zoci ext methods#1164

Merged
vmenge merged 5 commits intomainfrom
vm/zoci
Apr 21, 2026
Merged

feat(zenorb): zoci ext methods#1164
vmenge merged 5 commits intomainfrom
vm/zoci

Conversation

@vmenge
Copy link
Copy Markdown
Collaborator

@vmenge vmenge commented Apr 21, 2026

changes

adds and documents extension methods for the Zenoh Orb Command Interface: small helpers for sending commands using zenoh queries and using strings/json underneath

small example, using utility methods:

  • Query::args
  • Query::res
  • zenorb::Session::command_raw
  • Result<Reply, ReplyErr>::json
use zenorb::zoci::{ReplyExt, ZociQueryExt};

blue.receiver(())
    .queryable("tuple", async |_ctx, query| {
        let args: (String, String) = query.args()?;
        query.res(&args).await?;

        Ok(())
    })
    .run()
    .await?;

let red = Zenorb::from_cfg(client_cfg.clone())
    .orb_id(orb_id.clone())
    .with_name("red")
    .await?;

let reply = red.command_raw("blue/tuple", "one two").await?;
let reply: Result<(String, String), String> = reply.json()?;

@vmenge vmenge requested a review from a team as a code owner April 21, 2026 16:01
Comment thread zenorb/src/sender.rs
&self,
keyexpr: &str,
payload: impl Serialize,
) -> Result<Result<Sample, ReplyError>> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 results?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeee

1st one is infra error
2nd one must be handled, ReplyErr contains actual error payload which is nice from zenoh

look a little awkward on type but usage in practice is pretty smooth bc outer error is color_eyre (see tests / examples)

@sky-mart
Copy link
Copy Markdown
Contributor

I'm not yet familiar with all rust features used, but overall looks good.
I don't get 2 things:

  1. Where is the command finally executed?
  2. Can I create my util using this crate to connect to an orb's zenoh and run commands on an orb?

@vmenge
Copy link
Copy Markdown
Collaborator Author

vmenge commented Apr 21, 2026

I'm not yet familiar with all rust features used, but overall looks good. I don't get 2 things:

  1. Where is the command finally executed?
  2. Can I create my util using this crate to connect to an orb's zenoh and run commands on an orb?
  1. if you declare it in a zenorb::Receiver, its guaranteed to run in a tokio::task in the background once run is called (example)

  2. yeee 100% :D (tho only dev orbs)

@vmenge vmenge enabled auto-merge (squash) April 21, 2026 16:45
@vmenge vmenge merged commit 9c2204f into main Apr 21, 2026
23 checks passed
@vmenge vmenge deleted the vm/zoci branch April 21, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants