Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaymine/TCP-eventbus-client-Python
vertx tcp eventbus client module for python
https://github.com/jaymine/TCP-eventbus-client-Python
Last synced: 3 months ago
JSON representation
vertx tcp eventbus client module for python
- Host: GitHub
- URL: https://github.com/jaymine/TCP-eventbus-client-Python
- Owner: jaymine
- License: mit
- Created: 2016-06-10T14:54:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-05T13:56:20.000Z (over 8 years ago)
- Last Synced: 2024-11-14T17:08:29.185Z (3 months ago)
- Language: Python
- Homepage:
- Size: 951 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- vertx-awesome - Python - Event bus client for Python using the [TCP-based protocol](https://github.com/vert-x3/vertx-tcp-eventbus-bridge). (Vert.x Event Bus Clients)
README
# TCP-eventbus-client-Python
This is a TCP eventbus implementation for python clients. The protocol is quite simple:
* 4bytes int32 message length (big endian encoding)
* json string
* built-in keys1) type: (String, required) One of "send", "publish", "register", "unregister".
2) headers: (Object, optional) Headers with JSON format. Value of string type is supported.
3) body: (Object, optional) Message content in JSON format.
4) address: (String, required) Destination address
5) replyAddress: (String, optional) Address for replying to.
Download: !https://pypi.python.org/pypi/vertx-eventbus/1.0.0
See wiki for more information.example:
```python
class Client():
#Handler
def Handler(self,message):
if message != None:
print(message['body']['result'],'4');eb=Eventbus.Eventbus(Client(),'localhost', 7000)
#jsonObject -body
body={'msg':'add 4 to 0',}#DeliveryOption
do=DeliveryOption.DeliveryOption();
do.addHeader('type','text')
do.addHeader('size','small')
do.addReplyAddress('add')
do.setTimeInterval(5)#register handler
eb.registerHandler('add',Client.Handler);#send
eb.send('add',body,do)#close after 5 seconds
eb.closeConnection(5)
```examples :
Simple example,
TimeKeeper