Git Product home page Git Product logo

webhooks-rs's Introduction

Caution

The project is not finished, it is not stable and it is constantly being developed.

webhooks-rs

build contributors commit-activity

ℹ️ About

webhooks-rs is a project for sending webhooks using the http protocol. The main goals and objectives are to create an application that is high-performing, configurable and scalable.

Note

This project takes part and was created thanks to the 100 Commits challenge and is my first significant project written in Rust.

MVP features

  • Retry policy for failed messages
  • Endpoint can be disabled manually
  • Circuit breaker
  • Persistence
  • SDK Beta
  • CLI Beta
  • Documentation
  • Integration tests
  • Error handling and validation (as POC)

Roadmap

  • Release sdk as crate and bins (with GitHub action)
  • Sem ver
  • Rate-limit
  • Auth
  • Signed webhooks - server can verify that message was sent from valid server
  • Distributed architecture
  • Data retention
  • Logging and monitoring
  • Dockerized

📚 Domain explanation

Application - Is a container that groups endpoints. In a multi-tenant architecture, it can be a separate tenant. Each application can have a separate configuration and secrets (in progress...).

Endpoint - This is the url of the server to which messages are sent. Each endpoint can be deactivated individually - either manually or automatically by the circuit breaker. Endpoint can be only in one application.

Event - This is an event that originated in your system. The event has a topic and a payload. For now, it only supports JSON payload.

Message - In a nutshell, it can be said to be an event for a given endpoint. A given event can be distributed to several endpoints.

Attempt - This is a log of attempts to deliver a particular message. A given message may have multiple delivery attempts (e.g. endpoint is temporarily unavailable and message had to be retried by retry policy).

⚙️ How to use?

Server

Before run environment by using just init. This command run a docker and execute migrations. Server is split into two parts - server and dispatcher. Run just rs and just rd.

Server has rest api interface. Example commands you can find in server/server.http. Please familiarise oneself with Domain Explanation

SDK

Important

SKD requires running server and dispatcher. See Server section.

You can find an example of the use of the sdk in the examples/src/producer-server.rs

Cli

Important

Cli requires running server and dispatcher. See Server section.

To explore all possibilities run cargo run --package=cli. Cli is divided by resources sections.

Create application

$ cargo run --package=cli application create "example application"
App app_2hV5JuBgjMAQlDNNbepHTFnkicy with name 'example application' has been created

Create endpoint

To create an endpoint in a recently created application

$ cargo run --package=cli endpoint create app_2hV5JuBgjMAQlDNNbepHTFnkicy http://localhost:8090/ contact.created,contact.updated
Endpoint ep_2hV67JEIXUvFCN4bv43TUXVmX0s has been created

Create event

$ cargo run --package=cli event create app_2hV5JuBgjMAQlDNNbepHTFnkicy contact.created '{"foo":"bar"}'
Event evt_2hV6UoIY9p6YnLmiawSvh4nh4Uf has been created

👨‍💻 Development

Prerequisites

Troubleshoots

1. "Too many open files" during running tests

called `Result::unwrap()` on an `Err` value: Os { code: 24, kind: Uncategorized, message: "Too many open files" }

Execute (on linux/mac os) ulimit -n 10000 (default is 1024)

🤝 Contribution

If you want to contribute to the growth of this project, please follow the conventional commits in your pull requests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.