def send_message(self, message): """ Send message to the Browser. """ with app("rabbit") as rabbit: rabbit.basic_publish(exchange=self._EXCHANGE, routing_key=self.browser_uuid, body=dumps(message))
def engage_consumer(self, callback): with app("rabbit") as rabbit: rabbit.basic_consume(queue=self.queue, auto_ack=True, on_message_callback=callback)
def send_message(self, message): with app("rabbit") as rabbit: rabbit.basic_publish(exchange=self._EXCHANGE, routing_key=self.queue, body=dumps(message))
def create_queue(self): with app("rabbit") as rabbit: rabbit.queue_declare(queue=self.queue)
def queue(self): with app("settings") as settings: return settings["backend_queue"]