Dan Kenigsberg has submitted this change and it was merged.
Change subject: stomp: standalone client
......................................................................
stomp: standalone client
Convenience method to create stomp client by providing information
needed to connect like hostname, port, queue names that we want to use
and optional ssl context.
The client can send and receive messages and notifications.
JsonRpcClient can work in both synchronous and asynchronous way and it
uses an instance of Reactor to process I/O. Reactor is run in a thread
so it is important to close the client once it is not needed.
Standalone client is designed to exchange data with vdsm for external
services and jsonrpc based vdscli.
Usage example:
# auto starts and requires calling close
client = StandAloneRpcClient(host, port, 'jms.topic.vdsm_requests',
str(uuid4()), sslctx, False)
# or which manages client life cycle by using context manager 'running'
from vdsm.utils import running
with running(StandAloneRpcClient(acceptor._host, acceptor._port,
'jms.topic.vdsm_requests',
str(uuid4()), sslctx)) as client:
# To invoke vdsm methods we can use one of many call methods
client.callMethod('my_method_name', data, uuid)
# To receive events we need to register a callback
def callback(client, event, params):
pass
client.registerEventCallback(callback)
# It is important to close the client which stops the I/0 thread if not
# managed by context manager
client.close()
Change-Id: I8af6272679e115cf8eb80a14227476b59812581c
Signed-off-by: pkliczewski <[email protected]>
Reviewed-on: https://gerrit.ovirt.org/42850
Continuous-Integration: Jenkins CI
Reviewed-by: Yeela Kaplan <[email protected]>
Reviewed-by: Yaniv Bronhaim <[email protected]>
Reviewed-by: Dan Kenigsberg <[email protected]>
---
M lib/yajsonrpc/__init__.py
M lib/yajsonrpc/stompreactor.py
M tests/Makefile.am
A tests/stompTests.py
4 files changed, 129 insertions(+), 0 deletions(-)
Approvals:
Piotr Kliczewski: Verified
Yeela Kaplan: Looks good to me, but someone else must approve
Yaniv Bronhaim: Looks good to me, but someone else must approve
Jenkins CI: Passed CI tests
Dan Kenigsberg: Looks good to me, approved
--
To view, visit https://gerrit.ovirt.org/42850
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8af6272679e115cf8eb80a14227476b59812581c
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <[email protected]>
Gerrit-Reviewer: Adam Litke <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: Piotr Kliczewski <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: Yeela Kaplan <[email protected]>
Gerrit-Reviewer: [email protected]
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches