Skip to content

Latest commit

 

History

History
54 lines (45 loc) · 1.35 KB

README.md

File metadata and controls

54 lines (45 loc) · 1.35 KB

Stallion Python SDK


go version version
version version version

Client SDK for Stallion message broker

How to use?

Python install:

pip install stallion-python-sdk

Client

Create 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

# publish an object on a topic
c.Publish("book", {'author': "Amirhossein", 'name': "Stallion"})

Subscribe

# 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

# unsubscribe from a topic
c.Unsubscribe("book")