Self.iDebugLevel = dParams.get('iDebugLevel', 4) Self.sVirtualHost = dParams.get('sVirtualHost', '/') # I think really this should be Mt4 specific - for permissions Self.sPassword = dParams.get('sPassword', 'guest') Self.sUsername = dParams.get('sUsername', 'guest') Self.sExchangeName = dParams.get('sExchangeName', 'Mt4') # I think we want one exchange per terminal process # I think really this should be program PID specific Self.sHostAddress = dParams.get('sHostAddress', '127.0.0.1') Self.iReqRepPort = dParams.get('iReqRepPort', 5672) Self.iSubPubPort = dParams.get('iSubPubPort', 5672) Return pika.ConnectionParameters(settings.RABBITMQ_HOST, # TCP_KEEPIDLE to something significantly below 15 minutes. # To avoid this killing our RabbitMQ connections, we set # connections after as little as ~15 minutes of inactivity. # Some Kubernetes / Docker Swarm networks can kill "idle" TCP # point, it send them every TCP_KEEPINTVL (typically 75s). # after TCP_KEEPIDLE (7200 seconds) of inactivity after that # systems, the default is to start sending keepalive packets # keepalive on this connection is the TCP keepalive (defaults: # Where we've disabled RabbitMQ's heartbeat, the only # heartbeat doesn't make sense with BlockingConnection (we do # self.rabbitmq_heartbeat=0, which asks to explicitly disable Thread = threading.Thread(target=start_consuming)ĭef _get_parameters(self) -> pika.ConnectionParameters:Ĭredentials = pika.PlainCredentials(settings.RABBITMQ_USERNAME, Self._channel_request.queue_declare(queue=self._request_pipe_name)Ĭhannel_response.queue_declare(queue=self._response_pipe_name)Ĭhannel_response.basic_consume(self._fetch_response_callback, queue=self._response_pipe_name) Self._channel_request.queue_delete(queue=self._request_pipe_name) _bind(exchange=utils.EXCHANGE, queue=utils.QUEUE_ON_OFF)Ĭonn = pika.BlockingConnection(pika.ConnectionParameters(host=self._rmq_server_addr,port=self._port,heartbeat=self.heartbeat,blocked_connection_timeout=None,virtual_host='/',credentials=pika.PlainCredentials(self._username,self._username))) _declare(exchange=utils.EXCHANGE, exchange_type='direct') #except as pe:Ĭherrypy.log("Error connecting to Queue! %s" % e, traceback=True) nnection = pika.BlockingConnection(parameters=parameters)Ĭherrypy.log("Connection to rabbitmq service established") "keyfile":PROJECT_PATH+"/certs/"+config.get('rabbitmq')Ĭherrypy.log("Trying to connect to rabbitmq service.") "certfile":PROJECT_PATH+"/certs/"+config.get('rabbitmq'), "ca_certs":PROJECT_PATH+"/certs/"+config.get('rabbitmq'), Parameters = pika.ConnectionParameters(credentials=credentials, Credentials = pika.PlainCredentials(config.get('rabbitmq'), config.get('rabbitmq'))
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |