Rust Integration Services
A modern, fast, and lightweight integration library written in Rust, designed for memory safety and stability. It simplifies the development of scalable integrations for receiving and sending data, with built-in support for common protocols.
Installation
Add rust-integration-services to your project Cargo.toml and select features.
[]
= { = "0", = ["http", "file", "schedule", "sftp"] }
Features
File
FileReceiver
Poll the directory ./io/in/
and receive a callback with the path of a matching file using regular expression.
let result = new
.filter
.receive
.await;
FileSender
Move a file from one directory to another.
let result = new
.send_move
.await;
Copy the contents from a file to another.
let result = new
.send_copy
.await;
Write a string to a file, appending the text.
let result = new
.send_string
.await;
Schedule
ScheduleReceiver
Run a task once every hour and receive an event when it triggers.
let result = new
.interval
.on_event
.receive
.await;
Run a task once every day at 03:00 UTC and receive an event when it triggers.
let result = new
.start_time
.interval
.on_event
.receive
.await;
HTTP
HttpReceiver
Run a HTTP receiver listening on 127.0.0.1:8080
that handles GET
and POST
requests on the root path.
.route
.route
.receive
.await;
new
HttpSender
Send a HTTP GET request to 127.0.0.1:8080
.
let response = new
.send
.await
.unwrap;
SFTP
Using SFTP requires openssl
to be installed on the system.
Make sure you also have the development packages of openssl installed.
For example, libssl-dev
on Ubuntu or openssl-devel
on Fedora.
SftpReceiver
Download all files from 127.0.0.1:22
user remote directory upload
and delete files after successful download.
Using on_event
callback to print on download start and success.
That way files can be processed asyncronously without blocking other downloads.
let result = new
.auth_password
.remote_dir
.delete_after
.on_event
.receive_files
.await;
SftpSender
Send a file to 127.0.0.1:22
user remote path upload
keeping the same file name.
A private key with a passphrase is used as authentication in this example.
let result = new
.private_key
.remote_path
.send_file
.await;
Send a string as a file to 127.0.0.1:22
user remote path upload
with a new file name.
A basic password is used as authentication in this example.
let result = new
.password
.remote_path
.file_name
.send_string
.await;