test
This commit is contained in:
parent
1008a55728
commit
747af2e2c3
4
.gitignore
vendored
4
.gitignore
vendored
@ -37,7 +37,7 @@ MANIFEST
|
|||||||
pip-log.txt
|
pip-log.txt
|
||||||
pip-delete-this-directory.txt
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
# Unit test / coverage reports
|
# Unit tests / coverage reports
|
||||||
htmlcov/
|
htmlcov/
|
||||||
.tox/
|
.tox/
|
||||||
.nox/
|
.nox/
|
||||||
@ -158,5 +158,5 @@ cython_debug/
|
|||||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
.idea/
|
||||||
|
|
||||||
|
0
example/__init__.py
Normal file
0
example/__init__.py
Normal file
5
example/config.yml
Normal file
5
example/config.yml
Normal file
@ -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
|
27
example/rpc_demo.py
Normal file
27
example/rpc_demo.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
from nameko.rpc import rpc, ServiceRpc
|
||||||
|
from namekoplus import init_statsd
|
||||||
|
|
||||||
|
|
||||||
|
class RpcResponderDemoService:
|
||||||
|
name = "rpc_responder_demo_service"
|
||||||
|
|
||||||
|
statsd = init_statsd('rpc_responder', 'localhost')
|
||||||
|
|
||||||
|
@rpc
|
||||||
|
@statsd.timer('hello')
|
||||||
|
def hello(self, name):
|
||||||
|
return "Hello, {}!".format(name)
|
||||||
|
|
||||||
|
|
||||||
|
class RpcCallerDemoService:
|
||||||
|
name = "rpc_caller_demo_service"
|
||||||
|
|
||||||
|
remote = ServiceRpc("rpc_responder_demo_service")
|
||||||
|
|
||||||
|
statsd = init_statsd('rpc_caller', 'localhost')
|
||||||
|
|
||||||
|
@rpc
|
||||||
|
@statsd.timer('remote_hello')
|
||||||
|
def remote_hello(self, value="John Doe"):
|
||||||
|
res = u"{}".format(value)
|
||||||
|
return self.remote.hello(res)
|
Loading…
Reference in New Issue
Block a user