コード例 #1
0
def delete_queues(suffix):
    suffix = suffix.replace('-', '_')

    queue_broker = urlparse(config.QUEUE_BROKER)
    if queue_broker.scheme != 'azureservicebus':
        click.echo(f'Skipping queue cleanup for {queue_broker.scheme}')
        return

    client = ServiceBusClient(
        service_namespace=queue_broker.hostname,
        shared_access_key_name=unquote(queue_broker.username),
        shared_access_key_value=unquote(queue_broker.password),
    )

    for queue in client.list_queues():
        if queue.name.endswith(suffix):
            click.echo(f'Deleting queue {queue.name}')
            client.delete_queue(queue.name)
コード例 #2
0
def test_sb_client_entity_delete(live_servicebus_config, standard_queue):

    client = ServiceBusClient(
        service_namespace=live_servicebus_config['hostname'],
        shared_access_key_name=live_servicebus_config['key_name'],
        shared_access_key_value=live_servicebus_config['access_key'],
        debug=True)

    with pytest.raises(ServiceBusResourceNotFound):
        client.delete_queue("invalid", fail_not_exist=True)

    client.delete_queue("invalid", fail_not_exist=False)
    client.delete_queue(standard_queue)
コード例 #3
0
def test_sb_client_entity_delete(live_servicebus_config, standard_queue):

    client = ServiceBusClient(
        service_namespace=live_servicebus_config['hostname'],
        shared_access_key_name=live_servicebus_config['key_name'],
        shared_access_key_value=live_servicebus_config['access_key'],
        debug=True)

    with pytest.raises(ServiceBusResourceNotFound):
        client.delete_queue("invalid", fail_not_exist=True)

    client.delete_queue("invalid", fail_not_exist=False)
    client.delete_queue(standard_queue)
コード例 #4
0
    def test_sb_client_entity_delete(self, servicebus_namespace,
                                     servicebus_namespace_key_name,
                                     servicebus_namespace_primary_key,
                                     servicebus_queue, **kwargs):

        client = ServiceBusClient(
            service_namespace=servicebus_namespace.name,
            shared_access_key_name=servicebus_namespace_key_name,
            shared_access_key_value=servicebus_namespace_primary_key,
            debug=False)

        with pytest.raises(ServiceBusResourceNotFound):
            client.delete_queue("invalid", fail_not_exist=True)

        client.delete_queue("invalid", fail_not_exist=False)
        client.delete_queue(servicebus_queue.name)