Package: vertx-eventbus-client
TCP-eventbus-client-PythonThis is a TCP eventbus implementation for python clients.example:fromvertximportEventBusebus=EventBus('localhost',7000)# Define a handler to handle messagedefhandler(msg):print("Got message from server:%s"%msg)# Connects to target bridge, it will connect automaticallyebus.connect()# register a handler on address `test`ebus.register_handler("test",handler)# send a json message to address: `test`, the handler will be calledebus.send("test",body={'name':'python'})# You can also send a message, and specify the reply_addressebus.send("echo",reply_address="test",body={'desc':'send to echo, reply to test'})# publish messageebus.publish("publish-address",body={'name':'python'})# unregister the handler after everything is doneebus.unregister_handler("test")# close the EventBus to release resources, after closed, it cannot be used anymoreebus.close()OptionsThe options supported when creating the EventBus are:timeout- the socket timeout, in seconds, defaults to60seconds.connection_timeout- connection timeout, in seconds, defaults to600seconds.retry_interval- retry interval on connection, in seconds, defaults to5seconds.ping_interval- heart beat for ping/pong, in seconds, defaults to5seconds.reply_timeout- message reply timeout, in seconds, defaults to60seconds.auto_connect- if client should connect to server automatically if it is not connected yet, or on failures, defaults toTrue.ssl_options- thesslrelated options, please refer toSSL Optionsbelow.TLS supportThis client supports TLS connection, you need to either specify thessl_optionsor assl.SSLContext:fromvertximportEventBus# for no ClientAuth required, just specify the ca_file:ebus=EventBus(options={"ssl_options":{"ca_file":"/path/to/ca.crt"}})# you can also specify the ca_path(directory of the certs) or ca_data:ebus=EventBus(options={"ssl_options":{"ca_path":"/path/to/certs/"}})ebus=EventBus(options={"ssl_options":{"ca_data":"my_cert_data"}})# for ClientAuth, specify cert_file and key_file:ebus=EventBus(options={"ssl_options":{"ca_file":"/path/to/ca.crt","cert_file":"/path/to/client.crt"},"key_file":"/path/to/client.key"})# You can also specify a SSLContext directly if you have one already:my_content=create_ssl_context()ebus=EventBus(host="localhost",port=7000,ssl_context=my_context)SSL OptionsThe SSL options supported by this client are:ca_file- The CA certificate file which is used to verity the server.ca_path- The directory where the CA certificates are.ca_data- The CA certificate data which is used to verify the server.ciphers- The ciphers client wants to use on ssl handshake.check_hostname- Should check hostname or not.
When any ofca_*is specified, it isTrueif it is not specified.verify_mode- Verify mode when doing handshake.
When any ofca_*is specified, it isssl.CERT_REQUIREDif it is not specified.cert_file- The client certificate file in ClientAuth case.key_file- The client key file in ClientAuth case.key_password- The password of client key file in ClientAuth case.Build and install locally# build the package
./build.sh --dist

# With the tar file you can install it anywhere
pip install dist/vertx-eventbus-client*.tar.gz

# Install from PyPI:
pip install vertx-eventbus-clientBuild and Deploy to PyPi:Update the version in thesetup.py:# change this value to the desired version, like: 1.0.0version="1.0.0.dev0"Use the following command to build and publish to PyPi:./build.sh--publishthen you will be asked for username and password like:PublishthepackagetoPypi.org
Uploadingdistributionstohttps://upload.pypi.org/legacy/
Enteryourusername:NOTE: You need to havetwineinstalled in your machine to be able to publish.