SkillAgentSearch skills...

Srad

A library for the Sparkplug IoT specification in Rust

Install / Use

/learn @dpazj/Srad
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

srad

srad is a Sparkplug library and development framework in Rust.

CI Documentation Crates.io MIT licensed Apache-2.0 licensed

Additional information for this crate can be found in the docs.

Overview

srad aims to make it easy as possible to build reliable, fast, and resource efficient Sparkplug B Edge Nodes and Applications with minimal overhead.

Features include:

  • Data Type Support - Support for Sparkplug data types including Array types, Property Sets and Templates
    • Template Derive macros provide code generation for template implementations
  • Compliance-focused APIs - APIs designed to prevent non-conformance of the specification
  • Async Node and Application development frameworks - Ready-to-use frameworks built using tokio, providing out-the-box compatibility, scalable implementations, and support for Node/Application specific features
  • MQTT Client Agnostic - Flexible architecture providing the ability to choose the best MQTT implementation for your use case

Getting Started

Examples

A simple Edge Node

use srad::{client_rumqtt, eon::{EoN, EoNBuilder, NoMetricManager}};

#[tokio::main]
async fn main() {

    let opts = client_rumqtt::MqttOptions::new("foo:bar", "localhost", 1883);
    let (eventloop, client) = client_rumqtt::EventLoop::new(opts, 0);

    let (mut eon, handle) = EoNBuilder::new(eventloop, client)
        .with_group_id("foo")
        .with_node_id("bar")
        .with_metric_manager(NoMetricManager::new())
        .build().unwrap();

    eon.run().await;
}

A simple Application

use srad::app::{SubscriptionConfig, generic_app::ApplicationBuilder};
use srad::client_rumqtt;

#[tokio::main]
async fn main() {
    let opts = client_rumqtt::MqttOptions::new("foo", "localhost", 1883);
    let (eventloop, client) = client_rumqtt::EventLoop::new(opts, 0);
    let (mut application, client) = ApplicationBuilder::new("foo", eventloop, client, SubscriptionConfig::AllGroups).build();
    application.run().await
}

More examples can be found in the examples and in the docs.

Dependencies

codegen uses protoc Protocol Buffers compiler to generate types.

Project Layout

  • srad: Re-exports the srad-* crates under one package.
  • srad-eon: SDK for building Sparkplug Edge Nodes.
  • srad-app: SDK for building Sparkplug Applications.
  • srad-client: Trait and type definitions for implementing clients to interact with Sparkplug.
  • srad-client-rumqtt: Client implementation using rumqtt.
  • srad-types: Utility and Protobuf generated types.
  • srad-macros: Derive macro implementation for Templates
  • codegen: Generates types from protobuf files in protos.
  • examples: Example Edge Node and application implementations.

License

This project is dual licensed under the MIT and APACHE licenses.

View on GitHub
GitHub Stars7
CategoryProduct
Updated26d ago
Forks0

Languages

Rust

Security Score

90/100

Audited on Mar 5, 2026

No findings