srad is a Sparkplug library and development framework in Rust.
Additional information for this crate can be found in the docs.
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
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;
}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.
codegen uses protoc Protocol Buffers compiler to generate types.
srad: Re-exports thesrad-*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 Templatescodegen: Generates types from protobuf files inprotos.examples: Example Edge Node and application implementations.
This project is dual licensed under the MIT and APACHE licenses.