from nameko.containers import ServiceContainer
from nameko.rpc import rpc
class Service:
name = "servicee"
@rpc
def test(self):
return "hi"
# create a container
container = ServiceContainer(Service, config={"AMQP_URI": "amqp://guest:gu...@127.0.0.1:5672/"})
# ``container.extensions`` exposes all extensions used by the service
service_extensions = list(container.extensions)
# start service
container.start()
# stop service
container.stop()
$ nameko shell --broker amqp://guest:gu...@127.0.0.1:5672/Nameko Python 3.6.3 (default, Oct 10 2017, 16:21:48) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] shell on darwinBroker: amqp://guest:gu...@127.0.0.1:5672/>>> n.rpc.servicee<nameko.rpc.ServiceProxy object at 0x10c7a2940>>>> n.rpc.servicee.hi()