Piotr Kliczewski has posted comments on this change.
Change subject: broker_support ......................................................................
Patch Set 1: Code-Review-1
(6 comments)
http://gerrit.ovirt.org/#/c/36368/1/lib/yajsonrpc/__init__.py File lib/yajsonrpc/__init__.py:
Line 98: method = obj.get("method") Line 99: if method is None: Line 100: raise JsonRpcInvalidRequestError("missing method header", obj) Line 101: Line 102: reqId = obj.get("id") Jsonrpc notifications are similar to requests and here we could not check for presence of Id. Line 103: if not isinstance(reqId, (str, unicode, int)): Line 104: raise JsonRpcInvalidRequestError("missing request identifier", Line 105: obj) Line 106:
Line 164: Line 165: result = obj.get("result") Line 166: error = obj.get("error") Line 167: Line 168: reqId = obj.get("id") According to spec id member is REQUIRED. Line 169: Line 170: return JsonRpcResponse(result, error, reqId) Line 171: Line 172:
Line 340: ) Line 341: Line 342: ctx = self._runningRequests.pop(resp.id) Line 343: Line 344: ctx.addResponse(resp) At this stage we will gate AttributeError if resp.id is None. Line 345: Line 346: self._finalizeCtx(ctx) Line 347: Line 348: def _isResponse(self, obj):
http://gerrit.ovirt.org/#/c/36368/1/lib/yajsonrpc/stomp.py File lib/yajsonrpc/stomp.py:
Line 58: SUBSCRIPTION = "subscription" Line 59: DESTINATION = "destination" Line 60: ACCEPT_VERSION = "accept-version" Line 61: REPLY_TO = "reply-to" Line 62: HOST = "host" Can you give a description for headers which are not part of stomp spec? Line 63: Line 64: Line 65: COMMANDS = tuple([command for command in dir(Command) Line 66: if not command.startswith('_')])
Line 437: Line 438: def _process_message(self, frame, dispatcher): Line 439: sub_id = frame.headers.get(Headers.SUBSCRIPTION) Line 440: if sub_id is None: Line 441: self.log.warning( subscription header is not required by spec so we should not force it. Line 442: "Got message without a subscription" Line 443: ) Line 444: return Line 445:
http://gerrit.ovirt.org/#/c/36368/1/lib/yajsonrpc/stompReactor.py File lib/yajsonrpc/stompReactor.py:
Line 200: def get_local_address(self): Line 201: return self._socket.getsockname()[0] Line 202: Line 203: Line 204: class StompClient(object): How do you want to send events? I do not see a way to do so with structure of this code. Line 205: log = logging.getLogger("jsonrpc.AsyncoreClient") Line 206: Line 207: def __init__(self, sock, reactor): Line 208: self._reactor = reactor