Skip to content

Latest commit

 

History

History
140 lines (97 loc) · 4.64 KB

README.md

File metadata and controls

140 lines (97 loc) · 4.64 KB

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.