diff --git a/neon_mq_connector/consumers/select_consumer.py b/neon_mq_connector/consumers/select_consumer.py index 221f31c..e00e3e2 100644 --- a/neon_mq_connector/consumers/select_consumer.py +++ b/neon_mq_connector/consumers/select_consumer.py @@ -77,9 +77,9 @@ def __init__(self, """ threading.Thread.__init__(self, *args, **kwargs) try: - self._io_loop = get_event_loop() + get_event_loop() except RuntimeError: - self._io_loop = new_event_loop() + set_event_loop(new_event_loop()) self._consumer_started = Event() # annotates that ConsumerThread is running self._channel_closed = threading.Event() self._is_consumer_alive = True # annotates that ConsumerThread is alive and shall be recreated @@ -105,8 +105,7 @@ def create_connection(self) -> pika.SelectConnection: return pika.SelectConnection(parameters=self.connection_params, on_open_callback=self.on_connected, on_open_error_callback=self.on_connection_fail, - on_close_callback=self.on_close, - custom_ioloop=self._io_loop) + on_close_callback=self.on_close) def on_connected(self, _): """Called when we are fully connected to RabbitMQ"""