Skip to content

cardo-org/Rembus.jl

Repository files navigation

Rembus

Stable Dev Build Status Coverage Code Style: Blue

Rembus is a middleware to implement high performance and fault-tolerant distributed applications using RPC and Pub/Sub communication styles.

Key Features

  • Built-in support for exchanging DataFrames.

  • Macro-based API that make writing RPC and Pub/Sub applications simple and fast.

  • Multiple transport protocols: Tcp, Web Socket, ZeroMQ.

  • Binary message encoding using CBOR.

The broker

Start the broker:

julia -e "using Rembus; broker()"

RPC server

@component "myserver"

function myservice(arg1)
    return "hello $arg1 💗"
end

@expose myservice

# Serve forever until Ctrl-C 
@forever

The @component macro declares a unique name for the component that get known to the broker. On the broker side such identity permits to bind a twin operating on the behalf of the component either when it is offline.

RPC client

response = @rpc myservice("rembus")

When a name is not declared with @component then a random uuid identifier is associated with the component each time the application starts.

Pub/Sub subscriber

@component "myconsumer"

function mytopic(df::DataFrame)
    println("mean_a=$(mean(df.a)), mean_b=$(mean(df.b))")
end

@subscribe mytopic

# Receive messages forever until Ctrl-C 
@forever

Pub/Sub publisher

df = DataFrame(a=1:1_000_000, b=rand(1_000_000))

# Fire and forget is the fastest publishing mechanism.
# at most once delivery guarantee.
@publish mytopic(df)

# Messages are acknowledged and eventually retransmitted.
# at least once delivery guarantee.
@publish mytopic(df) QOS1

# Exactly once delivery guarantee.
@publish mytopic(df) QOS2

About

A middleware for RPC and Pub/Sub communication styles

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages