Crates.io | transmit |
lib.rs | transmit |
version | 0.1.1 |
source | src |
created_at | 2024-02-07 22:15:49.652392 |
updated_at | 2024-02-18 14:07:53.751234 |
description | Transmission scheduler of delayed and periodic messages. |
homepage | https://github.com/kasbuunk/transmit |
repository | https://github.com/kasbuunk/transmit |
max_upload_size | |
id | 1131055 |
size | 303,469 |
This project is licensed under the MIT License.
Transmit is a program designed for reliable scheduling and transmission of delayed and periodic messages. It is built with a modular architecture and agnostic design, allowing for seamless integration into various deployment environments.
Key Features:
Currently, the defined binary application only supports a postgres repository and nats transmitter adapters. It is hence required that these are running and accessible on the host and ports defined in your provided configuration file.
For convenience, these dependencies are provided in the ./docker-compose.yaml
file at the root of the repository.
# Checkout the repository.
git checkout https://github.com/kasbuunk/transmit
cp transmit
# Run dependencies (verify no conflicting pre-existing processes listen on these ports).
make setup
# Install
cargo install transmit
# Copy the configuration file.
cp sample.ron config.ron # Adjust to access nats and postgres dependencies.
# Run the program.
transmit config.ron
To run the entire program and its dependencies in docker-compose, refer to the tests
directory for a correct and continuously tested example configuration.
The primary deployment environment for which this program is designed, is to run as a microservice in a Kubernetes cluster.
To deploy with helm, run the following.
# Add the helm repository.
helm repo add transmit https://kasbuunk.github.io/transmit
# Install the release. N.B.: make sure the required dependencies (Nats and Postgres) are deployed and accepting connections on the configured ports, with the configurable Postgres connection credentials.
helm install transmit transmit/transmit --values tests/values.yaml # Replace with your configuration.
Usage depends on the configured transport adapter and chosen Message
variant.
Supported transport adapters:
proto/client/{LANGUAGE}
. Initialise the client with the host and port that the Tranmit service is running on. Next, build and send gRPC requests with the client.Supported Message
variants:
NatsEvent
: Provided that a message was scheduled to be transmitted, connect to the Nats server configured as a transmission dependency of the Transmit deployment and assert the expected scheduled events are published.For example, if Nats is running in Kubernetes, run in separate terminals:
Prerequisites: kubectl
and nats
CLIs.
# Make nats accessible from the host.
kubectl port-forward svc/nats 4222:4222
# Observe and assert the expected events are published when scheduled.
nats sub -s "nats://localhost:4222" "MYSUBJECT.details"
Please refer to the client/go/client_test.go
file for a simple, correct test how to interact with the Transmit program.
The proto/transmit.proto
file contains the necessary types and gRPC definitions in order to generate the protobuf and gRPC client code for most popular programming languages.
The program applies careful separation of concerns. It is designed in the first place to be agnostic to its deployment environment.
The application has a set of loosely-coupled components. Each is defined by a trait in the contract
module, such that components are properly unit-tested. The compose to a suitable set of adapters be implemented across an array of deployment environments.
The scheduler is the core in the program that defines the domain behaviour. It is responsible to determine what messages ought to be transmitted, when to do so and negotiates state retrieval and management of the scheduled transmissions with the repository.
Supported Schedule
variants:
Delayed
: schedule transmission at a given time.Interval
: schedule transmission, starting at a given time and then repeated with a given interval duration.Cron
: schedule transmission, starting after a given time and then repeated with a given cron schedule.The repository is responsible for executing the state updates as commanded by the scheduler.
Supported adapters:
For each Message
variant, a transmission adapter is implemented to broker transmission. The transmitter is responsible to send the messages and report if transmission was successful, such that the scheduler can remain agnostic of the implementation details.
Supported adapters:
The transport adapter is responsible for incoming message parsing and brokerage between outside invokers and the domain core, i.e. the Scheduler.
Supported transports:
The config
module provides an algebraic data structure that fully models the valid state of the system at startup. As such, the program will only start running if configured precisely with:
Message
variant.Any feedback and help with development is greatly appreciated. Please feel free to open issues or pull requests for feature requests, bug reports, installation issues or any other questions you may have.
The roadmap lists many features, additional Message
variants and targeted deployment environments, as well as other interesting features that make the state management of the Transmit program much more powerful. The roadmap is expected to change its contents and priorities. It is not ready to be shared publicly as of the current state of affairs.