Rembus is a middleware to implement high performance and fault-tolerant distributed applications using RPC and Pub/Sub communication styles.
-
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.
Start the broker:
julia -e "using Rembus; broker()"
@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.
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.
@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
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