Client SDK for Stallion message broker
Python install:
pip install stallion-python-sdkCreate a client:
# importing Client module
from stallion.client import Client
# creating a client
# with given stallion server url
c = Client(url="st://localhost:9090")# publish an object on a topic
c.Publish("book", {'author': "Amirhossein", 'name': "Stallion"})# creating a handler
# any published object will be given to this handler as data
def handler(data):
print(f'{data['author']}: {data['name']})
# subscribe over a topic with given handler
c.Subscribe("book", handler)# unsubscribe from a topic
c.Unsubscribe("book")