def StandAloneRpcClient(host, port, request_queue, response_queue, sslctx=None, lazy_start=True): """ Returns JsonRpcClient able to receive jsonrpc messages and notifications. It is required to provide host and port where we want to connect and request and response queues that we want to use during communication. We can provide ssl context if we want to secure connection. """ reactor = Reactor() def start(): thread = concurrent.thread(reactor.process_requests, name='Client %s:%s' % (host, port)) thread.start() client = StompClient(utils.create_connected_socket(host, port, sslctx), reactor) jsonclient = JsonRpcClient( ClientRpcTransportAdapter( client.subscribe(response_queue, sub_id=str(uuid4())), request_queue, client)) if lazy_start: setattr(jsonclient, 'start', start) else: start() return jsonclient
def StandAloneRpcClient(host, port, request_queue, response_queue, sslctx=None, lazy_start=True): """ Returns JsonRpcClient able to receive jsonrpc messages and notifications. It is required to provide host and port where we want to connect and request and response queues that we want to use during communication. We can provide ssl context if we want to secure connection. """ reactor = Reactor() def start(): thread = concurrent.thread(reactor.process_requests, name='Client %s:%s' % (host, port)) thread.start() client = StompClient(utils.create_connected_socket(host, port, sslctx), reactor) jsonclient = JsonRpcClient( ClientRpcTransportAdapter( client.subscribe(response_queue, sub_id=str(uuid4())), request_queue, client) ) if lazy_start: setattr(jsonclient, 'start', start) else: start() return jsonclient
def wrapper(protocol): (host, port) = listener sslctx = SSLContext(cert_file=CRT_FILE, key_file=KEY_FILE, ca_certs=CRT_FILE, protocol=protocol) return utils.create_connected_socket(host, port, sslctx=sslctx)
def clientFactory(): return client(utils.create_connected_socket( acceptor._host, acceptor._port, sslctx=sslctx, timeout=TIMEOUT ))
def _createClient(self, port): sslctx = sslutils.create_ssl_context() def is_ipv6_address(a): return (':' in a) and a.startswith('[') and a.endswith(']') if is_ipv6_address(self.remoteHost): host = self.remoteHost[1:-1] else: host = self.remoteHost client_socket = utils.create_connected_socket(host, int(port), sslctx) return self._vm.cif.createStompClient(client_socket)
def StandAloneRpcClient(host, port, request_queue, response_queue, sslctx=None, lazy_start=True, incoming_heartbeat=DEFAULT_INCOMING, outgoing_heartbeat=DEFAULT_OUTGOING, nr_retries=NR_RETRIES, reconnect_interval=RECONNECT_INTERVAL): """ Returns JsonRpcClient able to receive jsonrpc messages and notifications. It is required to provide host and port where we want to connect and request and response queues that we want to use during communication. We can provide ssl context if we want to secure connection. """ reactor = Reactor() def start(): thread = concurrent.thread(reactor.process_requests, name='Client %s:%s' % (host, port)) thread.start() client = StompClient(utils.create_connected_socket(host, port, sslctx), reactor, incoming_heartbeat=incoming_heartbeat, outgoing_heartbeat=outgoing_heartbeat, nr_retries=nr_retries, reconnect_interval=reconnect_interval) jsonclient = JsonRpcClient( ClientRpcTransportAdapter(request_queue, response_queue, client)) if lazy_start: setattr(jsonclient, 'start', start) else: start() return jsonclient
def StandAloneRpcClient(host, port, request_queue, response_queue, sslctx=None, lazy_start=True, incoming_heartbeat=DEFAULT_INCOMING, outgoing_heartbeat=DEFAULT_OUTGOING, nr_retries=NR_RETRIES, reconnect_interval=RECONNECT_INTERVAL): """ Returns JsonRpcClient able to receive jsonrpc messages and notifications. It is required to provide host and port where we want to connect and request and response queues that we want to use during communication. We can provide ssl context if we want to secure connection. """ reactor = Reactor() def start(): thread = concurrent.thread(reactor.process_requests, name='Client %s:%s' % (host, port)) thread.start() client = StompClient(utils.create_connected_socket(host, port, sslctx), reactor, incoming_heartbeat=incoming_heartbeat, outgoing_heartbeat=outgoing_heartbeat, nr_retries=nr_retries, reconnect_interval=reconnect_interval) jsonclient = JsonRpcClient( ClientRpcTransportAdapter( request_queue, response_queue, client) ) if lazy_start: setattr(jsonclient, 'start', start) else: start() return jsonclient
def use_client(self, host, port, protocol): sslctx = SSLContext(cert_file=CRT_FILE, key_file=KEY_FILE, ca_certs=CRT_FILE, protocol=protocol) utils.create_connected_socket(host, port, sslctx=sslctx)
def _createClient(self, port): sslctx = sslutils.create_ssl_context() client_socket = utils.create_connected_socket(self.remoteHost, int(port), sslctx) return self._vm.cif.createStompClient(client_socket)
def _createClient(self, port): sslctx = sslutils.create_ssl_context() client_socket = utils.create_connected_socket( self.remoteHost, int(port), sslctx) return self._vm.cif.createStompClient(client_socket)