Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def connect(self):
"""This method connects to RabbitMQ, returning the connection handle.
When the connection is established, the on_connection_open method
will be invoked by pika.
:rtype: pika.SelectConnection
"""
LOGGER.info("Connecting to %s", self._url)
parameters = pika.URLParameters(self._url)
return pika.SelectConnection(
parameters, self.on_connection_open, stop_ioloop_on_close=False
)
def open_connection(self):
"""
Open asynchronous connection for router/platform
:return:
"""
self._connection = pika.SelectConnection(self._connection_param,
on_open_callback=self.on_connection_open,
on_close_callback=self.on_connection_closed,
on_open_error_callback=self.on_open_error,
stop_ioloop_on_close=False
)
def connect(self):
"""
Create an asynchronous connection to the RabbitMQ server at URL.
"""
return pika.SelectConnection(pika.URLParameters(self._url),
on_open_callback=self.on_connection_open,
on_close_callback=self.on_connection_close,
stop_ioloop_on_close=False)
def connect(self):
LOGGER.info('Connecting to %s', self._url)
return pika.SelectConnection(pika.URLParameters(self._url),
self.on_connection_open,
stop_ioloop_on_close=False)
def connect(self):
"""
When the connection is established, the on_connection_open method
will be invoked by pika. If you want the reconnection to work, make
sure you set stop_ioloop_on_close to False, which is not the default
behavior of this adapter.
:rtype: pika.SelectConnection
"""
return pika.SelectConnection(
pika.URLParameters(
self._url),
on_open_callback=self.on_connection_open,
on_close_callback=self.on_connection_closed,
stop_ioloop_on_close=False)
def connect(self):
"""This method connects to RabbitMQ, returning the connection handle.
When the connection is established, the on_connection_open method
will be invoked by pika.
:rtype: pika.SelectConnection
"""
LOGGER.info('Connecting to %s', self._url)
return pika.SelectConnection(
parameters=pika.URLParameters(self._url),
on_open_callback=self.on_connection_open,
on_open_error_callback=self.on_connection_open_error,
on_close_callback=self.on_connection_closed)
def connect(self):
"""This method connects to RabbitMQ, returning the connection handle.
When the connection is established, the on_connection_open method
will be invoked by pika.
:rtype: pika.SelectConnection
"""
self.logger.info('Connecting to %s', self._url)
return pika.SelectConnection(
pika.URLParameters(self._url), self.on_connection_open, stop_ioloop_on_close=False
)
def connect(self):
_log.info("Connecting to %s:%d", self._parameters.host, self._parameters.port)
self._connection = pika.SelectConnection(
self._parameters,
on_open_callback=self._on_connection_open,
on_open_error_callback=self._on_connection_error,
on_close_callback=self._on_connection_close,
)
self.on_receive(self.channel_id, method_frame, header_frame, body)
self.host = kwargs.get('host', "localhost")
self.vhost = kwargs.get("vhost", "/")
params = pika.ConnectionParameters(host=self.host,
virtual_host=self.vhost)
if "user" in kwargs.keys() and "password" in kwargs.keys():
self.user = kwargs['user']
self.password = kwargs['password']
credentials = pika.PlainCredentials(self.user, self.password)
params.credentials = credentials
self.params = params
reconnect = pika.reconnection_strategies.SimpleReconnectionStrategy()
self.connection = pika.SelectConnection(params,
on_open_callback=on_connected,
reconnection_strategy=reconnect)
#self.connection.add_on_close_callback(on_closed)
self.connection.add_backpressure_callback(on_backpressure)