https://github.com/dapangmao/vertx-python-client
An asynchronous TCP eventbus Python client
https://github.com/dapangmao/vertx-python-client
asyncio python python3 vertx vertx-eventbus
Last synced: 11 months ago
JSON representation
An asynchronous TCP eventbus Python client
- Host: GitHub
- URL: https://github.com/dapangmao/vertx-python-client
- Owner: dapangmao
- License: mit
- Created: 2020-01-02T18:34:00.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-22T13:31:11.000Z (over 5 years ago)
- Last Synced: 2025-04-11T21:18:20.018Z (11 months ago)
- Topics: asyncio, python, python3, vertx, vertx-eventbus
- Language: Python
- Size: 31.3 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
vertx-python-client
---
An asynchronous TCP eventbus Python client other than the thread-based [official client](https://github.com/vert-x3/vertx-eventbus-bridge-clients/tree/master/python)
### Feature
1. Asynchronous
2. No dependency
3. Provides a command line interface
### Install
```
pip install vertx-python-client
```
### Usage
1. 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'}
```
2. use as a standard Python library
```python
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()
```
### Test
```
pytest tests
```