Lofar release 4 0
Merge request reports
Activity
282 """ 283 does the exchange with the given name exist on the given broker? 284 :param name: the name for the exchange 285 :param broker: a message broker address 286 :return True if it exists, False if not. 287 """ 288 try: 289 with kombu.Connection(hostname=broker, port=DEFAULT_PORT, userid=DEFAULT_USER, password=DEFAULT_PASSWORD) as connection: 290 exchange = kombu.Exchange(name, channel=connection) 291 try: 292 exchange.declare(channel=connection.default_channel, passive=True) 293 return True 294 except amqp.exceptions.NotFound: 295 return False 296 except Exception as e: 297 raise MessagingError("Could test if exchange %s exists on broker %s error=%s" % (name, broker, e)) 351 """ 352 does the queue with the given name exist on the given broker? 353 :param name: the name for the queue 354 :param broker: a message broker address 355 :return True if it exists, False if not. 356 """ 357 try: 358 with kombu.Connection(hostname=broker, port=DEFAULT_PORT, userid=DEFAULT_USER, password=DEFAULT_PASSWORD) as connection: 359 queue = kombu.Queue(name, no_declare=True, channel=connection) 360 try: 361 queue.queue_declare(channel=connection.default_channel, passive=True) 362 return True 363 except amqp.exceptions.NotFound: 364 return False 365 except Exception as e: 366 raise MessagingError("Could test if queue %s exists on broker %s error=%s" % (name, broker, e)) mentioned in commit 04287eec
Please register or sign in to reply