• Stars
    star
    169
  • Rank 224,453 (Top 5 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rust library to interact with CloudEvents

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.