An asynchronous TCP eventbus Python client other than the thread-based official client
- Asynchronous
- No dependency
- Provides a command line interface
pip install vertx-python-client
- use as a command line interface
python -m vertx localhost 8080
Welcome to the VertX shell. Type help or ? to list commands.
Press CTRL+C twice to quit
>> {"type": "register", "address": "app.version"}
07/21/20 07:48:00 - INFO: {'type': 'pong'}
- use as a standard Python library
from vertx import EventBusAsync, EventBusAsync
eb = EventBusAsync(host='localhost', port=1234)
eb.connect()
eb.add_listen_func(address="api.versions", action=lambda x: print(x))
# Send a JSON payload
reg = EventBusAsync(type="register", address="api.version")
eb.send(reg)
pub = EventBusAsync(type="publish", address="api.versions.", replyAddress="api.version")
eb.send(pub)
# Quit the connection
eb.disconnect()
pytest tests