Comments (3)
Your server script starts and then immediately stops the service https://github.com/jiamo/nameko_research/blob/master/test_service_server.py#L32
You don't need to create a ServiceRunner
yourself. You can use the nameko command line to run your service:
$ nameko run test_service_server --config nameko_server.conf
('config is ', {'AMQP_URI_CONFIG_KEY': 'amqp://guest:guest@localhost', 'max_workers': 10, 'AMQP_URI': 'amqp://guest:guest@localhost', 'parent_calls_tracked': 10, 'rpc_exchange': 'nameko-rpc'})
starting services: helloworld
Connected to amqp://guest:**@127.0.0.1:5672//
Also there is no need to implement the service client as you have. Just use the nameko command line:
nameko shell --config nameko_server.conf
>>> n.rpc.helloworld.hello(name='John')
u'Hello, John!'
from nameko.
Thanks. Some times we need run without nameko
command.
After using nameko run test_service_server --config nameko_server.conf
my client py can work now.
But after comment the runner.stop()
, python test_service_server.py
still can' t work.
from nameko.
You need to both apply the eventlet monkey patch and call wait()
on the runner to block until it exits.
index e764db8..8597563 100644
--- a/test_service_server.py
+++ b/test_service_server.py
@@ -1,3 +1,6 @@
+import eventlet
+eventlet.monkey_patch()
+
from nameko.rpc import rpc
from nameko.runners import ServiceRunner
from nameko.testing.utils import get_container
@@ -29,7 +32,7 @@ def main():
# start both services
runner.start()
- runner.stop()
+ runner.wait()
# container = ServiceContainer(HelloWorldService, config=config)
# service_extensions = list(container.extensions)
# print ("service_extensions is ", service_extensions)
You should really consider using the code from nameko.cli.run
even if you don't use the command line script, because the signal handing is non-trivial. For example, see https://github.com/onefinestay/nameko/blob/master/nameko/cli/run.py#L134
I'm going to close this issue now. If you have more questions about how to use nameko please post them to the (new!) google group.
from nameko.
Related Issues (20)
- AttributeError: 'SubRequest' object has no attribute 'funcargnames' HOT 3
- nameko.exceptions.UnknownService: Unknown service `service_x`
- nameko.exceptions.UnknownService: Unknown service `service_x` HOT 2
- Incompatible versions in the resolved dependencies between Nameko and Celery in Kombu HOT 4
- Use another augmented assignment statement HOT 1
- Check for existing key HOT 1
- Should ipython and bpython be listed in some configuration files? HOT 1
- Why using dnspython 1.x instead of 2.x ? HOT 8
- need upgrade to support python 3.10 HOT 2
- Publisher crashing when exchange is provided and RabbitMQ is down
- Nameko crashes when consuming illegal messages HOT 6
- [ DOUBT ] Events Pub / Sub - How can I make a consumer only run one event at a time
- from nameko.rpc import rpc class GreetingService: name = "greeting_service" def hello(self, name): return "Hello, {}!".format(name)
- Timer work on master process or every process? HOT 2
- dnspython dependency version overly restrictive HOT 3
- "verify_amqp_uri" in the module "nameko.amqp.utils" had been removed? HOT 2
- Should HttpRequestHandler print out the exception to the browser? HOT 2
- nameko multiprocess problem HOT 1
- Do you die? we need you to improve Nameko Library HOT 5
- DB Migrations not working with Flask-Migrate HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nameko.