def count_queue_messages(queue_name): connection = get_broker_connection(service['config']) channel = connection.channel() result = channel.queue_declare(durable=True, queue=queue_name, passive=True) return result.method.message_count def is_queue_empty(queue_name): return count_queue_messages(queue_name) == 0