Python

The rembus Python package provide both a synchronous and an asynchronous interface.

# async API
import rembus
# sync API
import rembus.sync as rembus

Getting Started

pip install rembus

Then create a component object to interact with the others components:

# sync API
rb = rembus.component()

# async API
rb = await rembus.component()

The rb object provides methods for exposing functions implementation, for subscribing to topics, for message publishing and for service requests:

  • rpc
  • publish
  • expose
  • subscribe

Request a service (RPC)

This example is a demo of requesting the service stats implemented in Julia.

  • A python pandas dataframe is created;
  • The pandas dataframe is used as an argument of the rpc service stats;
  • On the RPC server side the stats method receive a Julia DataFrame;
  • The return value of stats is a Julia Dictionary;
  • On the client RPC side the response is a python dictionary.
import rembus.sync as rembus
from random import random
import pandas as pd

df = pd.DataFrame({
    "name": [f"kpi_{i}" for i in range(1,6)],
    "ts": range(1,6),
    "value": [random() for i in range(1,6)]
})

rb = rembus.component()
summary = rb.rpc("stats", df)