#broker #redis #serverless #networking #client-send #data-transfer

bin+lib liner_broker

Redis based message serverless broker

10 stable releases

1.0.9 Nov 10, 2024
1.0.8 Oct 29, 2024
1.0.6 Oct 25, 2024
1.0.4 Oct 22, 2024
1.0.3 Oct 21, 2024

#237 in Concurrency

Download history 417/week @ 2024-10-18 437/week @ 2024-10-25 42/week @ 2024-11-01 110/week @ 2024-11-08 10/week @ 2024-11-15 3/week @ 2024-11-22 57/week @ 2024-12-06

72 downloads per month

MIT license

120KB
2.5K SLoC

liner

Redis based message serverless broker.
Data transfer via TCP.

Rust example:

use liner_broker::Liner;

fn  main() {

    let mut client1 = Liner::new("client1", "topic_client1", "localhost:2255", "redis://localhost/");
    let mut client2 = Liner::new("client2", "topic_client2", "localhost:2256", "redis://localhost/");
   
    client1.run(Box::new(|_to: &str, _from: &str, _data: &[u8]|{
        println!("receive_from {}", _from);
    }));
    client2.run(Box::new(|_to: &str, _from: &str, _data: &[u8]|{
        println!("receive_from {}", _from);
    }));

    let array = [0; 100];
    for _ in 0..10{
        client1.send_to("topic_client2", array.as_slice());
        println!("send_to client2");       
    }
}

Python example:

def foo():
    client1 = liner.Client("client1", "topic_client", "localhost:2255", "redis://localhost/")
    client2 = liner.Client("client2", "topic_client", "localhost:2256", "redis://localhost/")
    server = liner.Client("server", "topic_server", "localhost:2257", "redis://localhost/")
    
    client1.run(receive_cback1)
    client2.run(receive_cback2)
    server.run(receive_server)
    
    b = b'hello world'
    server.send_all("topic_client", b)
    

def receive_cback1(to: str, from_: str, data: bytes):
    print(f"receive_from {from_}, data: {data}")

def receive_cback2(to: str, from_: str, data: bytes):
    print(f"receive_from {from_}, data: {data}")

def receive_server(to: str, from_: str, data: bytes):
    print(f"receive_from {from_}, data: {data}")
    

Features

  • high speed transmission of multiple messages (benchmark)

  • delivery guarantee: at least once delivery (using redis db)

  • message size is not predetermined and is not limited

  • easy api: create client, run client and send data to

  • interface for Python and CPP

Build (only linux)

  • install Rust and Cargo
  • install Redis
  • download this repo
  • while in the folder repo, execute in console: cargo build

Examples of use

One to one: Python / CPP / Rust

lorem

One to one for many: Python / CPP / Rust

lorem

One to many: Python / CPP / Rust

lorem

Many to many: Python / CPP / Rust

lorem

Producer-consumer: Python / CPP / Rust

lorem

Benchmark

Tests

Docs

License

Licensed under an MIT-2.0-license.

Dependencies

~10MB
~183K SLoC