srad

Crates.iosrad
lib.rssrad
version0.3.0
created_at2025-03-06 22:06:50.379254+00
updated_at2025-07-22 20:46:44.905803+00
descriptionSparkplug development framework
homepagehttps://github.com/dpazj/srad
repositoryhttps://github.com/dpazj/srad
max_upload_size
id1581904
size30,813
Joe (dpazj)

documentation

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.

Commit count: 96

cargo fmt