Async Eureka client
Project description
WASP Eureka
Asynchronous Naive Eureka client for the Netflix OSS/Spring Cloud bundled eureka stack.
Installation
Note: this supports Python 3.5+
$ pip install wasp-eureka
Usage
The surface area of this module is pretty small, effectively you just need to care about the wasp_gateway.EurekaClient class and its methods:
import asyncio
from wasp_gateway import EurekaClient
# no spaces or underscores, this needs to be url-friendly
app_name = 'test-app'
port = 8080
# This needs to be an IP accessible by anyone that
# may want to discover, connect and/or use your service.
ip = '127.0.0.1'
my_eureka_url = 'https://service-discovery.mycompany.com/eureka'
loop = asyncio.get_event_loop()
eureka = EurekaClient(app_name, port, ip, eureka_url=my_eureka_url,
loop=loop)
async def main():
# Presuming you want your service to be available via eureka
result = await eureka.register()
assert result, 'Unable to register'
# You need to provide a heartbeat to renew the lease,
# otherwise the eureka server will expel the service.
# The default is 90s, so any time <90s is ok
while True:
await asyncio.sleep(67)
await eureka.renew()
loop.run_until_complete(main(loop=loop))
Depending on your framework, you probably want to use a scheduler (see APScheduler for support for a wide number of python frameworks)
Creating a Release
Bumpversion provides a simplified way to manage versioning, to check the dry run before running it:
$ bumpversion [patch,minor,major] --dry-run --verbose
$ bumpversion patch
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wasp-eureka-0.0.4.tar.gz
(5.2 kB
view hashes)
Built Distributions
wasp_eureka-0.0.4-py3.5.egg
(8.5 kB
view hashes)
Close
Hashes for wasp_eureka-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b35fc78e47556acc27d1449d1425fe99b7181d30ab928e6f5a668356288707e4 |
|
MD5 | b2c07e6591f901e542e49c0a41638229 |
|
BLAKE2b-256 | c97c2e5627de64916f752a25b92b9352ad520a0bf98fa029d06642b4924d71ea |