hedwig 0.1.1

A simple message bus for Rust
docs.rs failed to build hedwig-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: hedwig-7.1.0

Hedwig library for Rust

Build Status Latest Version

What is it?

Hedwig is a inter-service communication bus that works on AWS and GCP, while keeping things pretty simple and straight forward. It uses json schema draft v4 for schema validation so all incoming and outgoing messages are validated against pre-defined schema.

Hedwig allows separation of concerns between consumers and publishers so your services are loosely coupled, and the contract is enforced by the schema validation. Hedwig may also be used to build asynchronous APIs.

Support exists for Python and Golang.

For intra-service messaging, see Taskhawk.

Quick Start

Installation

Add to Cargo.toml:

[dependencies]
hedwig = "*"

Usage

    let schema = r#"
{
  "$id": "https://hedwig.standard.ai/schema",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Example Schema",
  "schemas": {
      "user-created": {
          "1.*": {
              "description": "A new user was created",
              "type": "object",
              "x-versions": [
                  "1.0"
              ],
              "required": [
                  "user_id"
              ],
              "properties": {
                  "user_id": {
                      "$ref": "https://hedwig.standard.ai/schema#/definitions/UserId/1.0"
                  }
              }
          }
      }
  },
  "definitions": {
      "UserId": {
          "1.0": {
              "type": "string"
          }
      }
  }
}"#;

    fn router(t: &MessageType, v: &MajorVersion) -> Option<&'static str> {
        match (t, v) {
            (&MessageType::UserCreated, &MajorVersion(1)) => Some("dev-user-created-v1"),
            _ => None,
        }
    }

    let hedwig = Hedwig::new(
        schema,
        "myapp",
        google_credentials,
        google_project,
        router,
    )?;

    let message = hedwig.message(
        MessageType::UserCreated,
        Version(MajorVersion(1), MinorVersion(0)),
        UserCreatedData { user_id: "U_123" },
    )?;

    let message_id = message.id;

    let publish_id = hedwig.publish(message)?;
    println!(
        "Published message {} with pubsub id: {}",
        message_id, publish_id
    );

There's also a full running example in the repo.

Getting Help

We use GitHub issues for tracking bugs and feature requests.

  • If it turns out that you may have found a bug, please open an issue