chore: add demo
This commit is contained in:
parent
c76238125f
commit
37bdf56862
|
@ -68,7 +68,7 @@ def cli():
|
||||||
@click.option('-t', '--type', '_type',
|
@click.option('-t', '--type', '_type',
|
||||||
default='all',
|
default='all',
|
||||||
show_default=True,
|
show_default=True,
|
||||||
type=click.Choice(['all', 'rpc', 'event', 'http', 'timer'], case_sensitive=False),
|
type=click.Choice(['all', 'rpc', 'event', 'http', 'timer', 'demo'], case_sensitive=False),
|
||||||
help='The template type of nameko service')
|
help='The template type of nameko service')
|
||||||
def init(directory, _type):
|
def init(directory, _type):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||||
|
WEB_SERVER_ADDRESS: '0.0.0.0:8000'
|
||||||
RPC_EXCHANGE: 'nameko-rpc'
|
RPC_EXCHANGE: 'nameko-rpc'
|
||||||
|
|
||||||
max_workers: 10
|
max_workers: 10
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||||
|
RPC_EXCHANGE: 'nameko-rpc'
|
||||||
|
|
||||||
|
max_workers: 10
|
||||||
|
parent_calls_tracked: 20
|
|
@ -0,0 +1,20 @@
|
||||||
|
from nameko.rpc import rpc, ServiceRpc
|
||||||
|
|
||||||
|
|
||||||
|
class RpcResponderDemoService:
|
||||||
|
name = "rpc_responder_demo_service"
|
||||||
|
|
||||||
|
@rpc
|
||||||
|
def hello(self, name):
|
||||||
|
return "Hello, {}!".format(name)
|
||||||
|
|
||||||
|
|
||||||
|
class RpcCallerDemoService:
|
||||||
|
name = "rpc_caller_demo_service"
|
||||||
|
|
||||||
|
remote = ServiceRpc("rpc_responder_demo_service")
|
||||||
|
|
||||||
|
@rpc
|
||||||
|
def remote_hello(self, value="John Doe"):
|
||||||
|
res = u"{}".format(value)
|
||||||
|
return self.remote.hello(res)
|
|
@ -1,4 +1,4 @@
|
||||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||||
RPC_EXCHANGE: 'nameko-rpc'
|
RPC_EXCHANGE: 'nameko-rpc'
|
||||||
|
|
||||||
max_workers: 10
|
max_workers: 10
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||||
|
WEB_SERVER_ADDRESS: '0.0.0.0:8000'
|
||||||
RPC_EXCHANGE: 'nameko-rpc'
|
RPC_EXCHANGE: 'nameko-rpc'
|
||||||
|
|
||||||
max_workers: 10
|
max_workers: 10
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||||
RPC_EXCHANGE: 'nameko-rpc'
|
RPC_EXCHANGE: 'nameko-rpc'
|
||||||
|
|
||||||
max_workers: 10
|
max_workers: 10
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||||
RPC_EXCHANGE: 'nameko-rpc'
|
RPC_EXCHANGE: 'nameko-rpc'
|
||||||
|
|
||||||
max_workers: 10
|
max_workers: 10
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -9,7 +9,7 @@ with open(path.join(here, 'README.md'), encoding='utf-8') as f:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='namekoplus',
|
name='namekoplus',
|
||||||
version='0.2.0',
|
version='0.2.1',
|
||||||
description='A lightweight Python distributed microservice solution',
|
description='A lightweight Python distributed microservice solution',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
|
|
Loading…
Reference in New Issue