Julia

Getting Started

Install the Rembus package and wait for the download and precompilation steps to complete:

julia> import Pkg; Pkg.add("Rembus")
   Resolving package versions...
   Installed Rembus ─ v1.0.0
   ...
Precompiling project...
  1 dependency successfully precompiled in 73 seconds. 72 already precompiled.

Rembus Node Types

Rembus defines three fundamental node types:

  • Component (Client)
    Connects to a Broker or directly to other nodes.

  • Broker
    Accepts connections and routes RPC and Pub/Sub messages between nodes.

  • Server
    Accepts connections and exposes RPC services.

Addressing and Connections

A Rembus node is identified by:

  • a node name
  • a network address (endpoint accepting connections)

These are combined into a single connection string.

Example: a Component named my_node connecting to a Broker over WebSockets:

rb = component("ws://localhost:8000/my_node")

Defaults

If omitted, Rembus applies sensible defaults:

  • Protocol: ws
  • Host: 127.0.0.1
  • Port: 8000

So this is equivalent:

rb = component("my_node")

Broker

A Broker can be started in multiple ways.

From the Julia REPL

using Rembus
Rembus.brokerd()

From the Command Line

julia -e 'using Rembus; Rembus.brokerd()'

By default, the Broker listens on WebSockets port 8000.

Multiple Endpoints

Brokers may expose multiple transports simultaneously:

julia -e 'using Rembus; Rembus.brokerd()' -- --ws 8000 --tcp 8001 --zmq 8002 --http 9000

Or from the REPL:

component(ws=8000, tcp=8001, zmq=8002, http=9000)

When the HTTP endpoint is enabled, you can verify broker status via JSON-RPC:

curl -X POST http://localhost:9000   -H "Content-Type: application/json"   -d '{"jsonrpc":"2.0","method":"uptime","id":"1234"}'

Hello World (RPC)

flowchart LR
  C(("Client")) --> S((Server))
  style C fill:#009E73, color:white
  style S fill:#0072B2, color:white

# server.jl
using Rembus

greet(who::AbstractString) = "ciao $who"

srv = component(name="server")
expose(srv, greet)
wait(srv)
# client.jl
using Rembus

cli = component("client")
rpc(cli, "greet", "mondo")

Typed arguments provide automatic validation. Passing invalid types raises a remote exception.

Handling Disconnections

Rembus components automatically handle disconnections and reconnections.

isopen(rb) # false when disconnected

Once the remote node restarts, reconnection happens transparently.

Publish / Subscribe

Publish-Subscribe can be implemented with or without a Broker.

Broker-Centric Pub/Sub

flowchart LR
  C(("Publisher")) --> B((Broker))
  B --> S1((Subscriber 1))
  B --> S2((Subscriber 2))
  style B fill:#F0E442, color:black
  style C fill:#009E73, color:white
  style S1 fill:#0072B2, color:white
  style S2 fill:#0072B2, color:white

Subscribers connect to a Broker:

sub = component(name="sub-1")
subscribe(sub, mytopic)

Publishers send messages through the Broker:

publish(pub, "mytopic", payload)

Brokerless Pub/Sub

flowchart LR
  C(("Publisher")) --> S1((Subscriber 1))
  C(("Publisher")) --> S2((Subscriber 2))
  style C fill:#009E73, color:white
  style S1 fill:#0072B2, color:white
  style S2 fill:#0072B2, color:white

Subscribers accept direct connections:

sub = component(name="sub-1", ws=3001)

Publishers connect directly to subscribers:

pub = component([
  "ws://:3001/pub",
  "ws://:3002/pub"
])

This model removes the central broker while preserving Pub/Sub semantics.

RPC Services

flowchart LR
  C(("Client")) --> B((Broker))
  B --> S((Server))
  style C fill:#009E73, color:white
  style B fill:#F0E442, color:black
  style S fill:#0072B2, color:white

Servers expose Julia functions as RPC services:

using Statistics, Rembus

function stats(df)
    Dict(
        "min" => minimum(df.value),
        "max" => maximum(df.value),
        "mean" => mean(df.value),
        "std" => std(df.value),
    )
end

@expose stats

Clients invoke services using @rpc:

summary = @rpc stats(df)

Broker Topologies

Rembus (Julia) supports advanced broker topologies that allow you to shape message flow according to your deployment needs:

  • Brokers in series
    Enable message routing across multiple network domains or organizational boundaries.

  • Brokers in parallel
    Provide redundancy and load distribution, improving availability and fault tolerance.

These topologies make it possible to build scalable, resilient, and failure-tolerant Rembus deployments without changing application logic. These patterns enable scalable and resilient deployments.

Security

Rembus supports authentication using:

  • RSA signatures
  • ECDSA signatures
  • Shared secrets

Authorization is enforced through private topics.

Automatic provisioning and deprovisioning is handled via register and unregister.

See the Security documentation.

Configuration

Rembus is configurable via environment variables and settings.json.

Configurable aspects include:

  • Data directories
  • Message timeouts
  • Keep-alive intervals
  • Connection behavior

See the Configuration documentation.