代码拉取完成,页面将自动刷新
同步操作将从 开放金融技术/zbus-python 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/\\\
\/\\\
\/\\\ /\\\\\\\\\ /\\\ /\\\
/\\\\\\\\\\\ \/\\\ /\\\ /\\\ /\\\\\\\\\\ /\\\/////\\\ \//\\\/\\\
\///////\\\/ \/\\\\\\\\\ \/\\\ \/\\\ \/\\\////// \/\\\\\\\\\\ \//\\\\\
/\\\/ \/\\\////\\\ \/\\\ \/\\\ \/\\\\\\\\\\ \/\\\////// \//\\\
/\\\/ \/\\\ \/\\\ \/\\\ \/\\\ \////////\\\ \/\\\ /\\ /\\\
/\\\\\\\\\\\ \/\\\\\\\\\ \//\\\\\\\\\ /\\\\\\\\\\ /\\\ \/\\\ \//\\\\/
\/////////// \///////// \///////// \////////// \/// \/// \////
zbus strives to make Message Queue and Remote Procedure Call fast, light-weighted and easy to build your own service-oriented architecture for many different platforms. Simply put, zbus = mq + rpc.
zbus carefully designed on its protocol and components to embrace KISS(Keep It Simple and Stupid) principle, but in all it delivers power and elasticity.
Start zbus, please refer to https://gitee.com/rushmore/zbus
Only demos the gist of API, more configurable usage calls for your further interest.
broker = Broker('localhost:15555')
p = Producer(broker)
p.declare('MyTopic')
msg = Message()
msg.topic = 'MyTopic'
msg.body = 'hello world'
res = p.publish(msg)
broker = Broker('localhost:15555')
def message_handler(msg, client):
print(msg)
c = Consumer(broker, 'MyTopic')
c.message_handler = message_handler
c.start()
broker = Broker('localhost:15555')
rpc = RpcInvoker(broker, 'MyRpc')
res = rpc.invoke(method='plus', params=[1,2])
print(res)
res = rpc.plus(1,22)
print(res)
res = rpc.getString('hong')
print(res)
broker.close()
class MyService(object):
def getString(self, ping):
return ping
def echo(self, ping):
return ping
def save(self, user):
return 'OK'
def plus(self, a, b):
return int(a) + int(b)
def testEncoding(self):
return u'中文'
p = RpcProcessor()
p.add_module(MyService) #could be class or object
broker = Broker('localhost:15555')
c = Consumer(broker, 'MyRpc')
c.connection_count = 1
c.message_handler = p #RpcProcessor is callable
c.start()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。