Introduction
Build scalable communication systems with Eclipse Zenoh
Get started with Zenoh on Raspberry Pi and Arm Linux
Containerize and deploy Zenoh across multiple Raspberry Pi devices
Run a simple Zenoh pub/sub example
Run a Zenoh storage and query example
Run a Zenoh queryable node for on-demand edge computation
Run a Zenoh queryable with parameterized Rust computation
Next Steps
This example shows how to use Zenoh’s queryable feature to return computed results in real time, instead of serving pre-stored values.
Unlike zenohd
which simply returns stored data, a queryable node can register to handle a specific key expression and generate responses at runtime. This is ideal for distributed computing at the edge, where lightweight devices, such as Raspberry Pi nodes, can respond to requests with calculated values. This pattern is ideal for sensor fusion, lightweight AI inference, and dynamic system diagnostics on resource-constrained edge devices.
Imagine a robot fleet management system where the central planner queries each robot for its latest battery health score, which is not published continuously but calculated only when queried.
This reduces bandwidth usage and enables edge-side optimization using Zenoh’s queryable feature.
On one Raspberry Pi device, run the z_queryable
Zenoh example to register a queryable handler.
cd ~/zenoh/target/release/examples
./z_queryable
You’ll see the output:
Opening session...
Declaring Queryable on 'demo/example/zenoh-rs-queryable'...
Press CTRL-C to quit...
The node is now ready to accept queries on the key demo/example/zenoh-rs-queryable
and respond with a predefined message.
On the other Raspberry Pi device, run the z_get
example.
cd ~/zenoh/target/release/examples
./z_get -s demo/example/zenoh-rs-queryable
You should see:
Opening session...
Sending Query 'demo/example/zenoh-rs-queryable'...
>> Received ('demo/example/zenoh-rs-queryable': 'Queryable from Rust!')
The result is shown below:
Figure 3: Computation on Query using Queryable
The response is generated dynamically by the queryable handler, and not fetched from stored data.
This model enables edge-based intelligence, such as:
Queryable is a key feature for data-in-use scenarios, allowing fine-grained, on-demand compute inside your Zenoh-powered architecture.
In the next example, you’ll extend this queryable pattern to support runtime parameters, such as battery level and temperature, allowing each node to return a calculated health score on demand.