9 releases (breaking)

0.7.0 Feb 24, 2023
0.6.0 Nov 7, 2022
0.5.0 Mar 18, 2022
0.4.0 Jul 7, 2021
0.0.1 Mar 13, 2020

#590 in Web programming

Download history 5225/week @ 2024-07-21 5768/week @ 2024-07-28 5146/week @ 2024-08-04 4202/week @ 2024-08-11 4897/week @ 2024-08-18 4630/week @ 2024-08-25 5042/week @ 2024-09-01 5045/week @ 2024-09-08 4924/week @ 2024-09-15 5748/week @ 2024-09-22 6172/week @ 2024-09-29 5452/week @ 2024-10-06 6583/week @ 2024-10-13 9572/week @ 2024-10-20 10116/week @ 2024-10-27 8329/week @ 2024-11-03

34,900 downloads per month
Used in 27 crates (22 directly)

Custom license

220KB
5K SLoC

CloudEvents SDK Rust Crates badge Docs badge

This project implements the CloudEvents Spec for Rust.

Note: This project is WIP under active development, hence all APIs are considered unstable.

Spec support

v0.3 v1.0
CloudEvents Core
AMQP Protocol Binding
AVRO Event Format
HTTP Protocol Binding
JSON Event Format
Kafka Protocol Binding
MQTT Protocol Binding
NATS Protocol Binding
Web hook

Crate Structure

The core modules include definitions for the Event and EventBuilder data structures, JSON serialization rules, and a mechanism to support various Protocol Bindings, each of which is enabled by a specific feature flag:

  • actix: Integration with actix.
  • axum: Integration with axum.
  • warp: Integration with warp.
  • reqwest: Integration with reqwest.
  • rdkafka: Integration with rdkafka.
  • nats: Integration with nats

This crate is continuously tested to work with GNU libc, WASM and musl toolchains.

Get Started

To get started, add the dependency to Cargo.toml, optionally enabling your Protocol Binding of choice:

[dependencies]
cloudevents-sdk = { version = "0.7.0" }

Now you can start creating events:

use cloudevents::{EventBuilder, EventBuilderV10};
use url::Url;

let event = EventBuilderV10::new()
    .id("aaa")
    .source(Url::parse("http://localhost").unwrap())
    .ty("example.demo")
    .build()?;

Checkout the examples using our integrations to learn how to send and receive events:

Development & Contributing

If you're interested in contributing to sdk-rust, look at Contributing documentation

Community

Each SDK may have its own unique processes, tooling and guidelines, common governance related material can be found in the CloudEvents community directory. In particular, in there you will find information concerning how SDK projects are managed, guidelines for how PR reviews and approval, and our Code of Conduct information.

Dependencies

~5–24MB
~375K SLoC